XHTML & Schemas

Oren Ben-Kiki oren at capella.co.il
Sun Sep 5 10:24:40 BST 1999


Paul Prescod <paul at prescod.net> wrote:
> Oren Ben-Kiki wrote:
> > ... If people want to have a single
> > namespace for XHTML, they should first go and re-write the above
paragraph
> > in the XSchema draft. Right?
>
> What would you rewrite it to? Let's say you have three schemas for XHTML
> on your hard drive or on the web. Let's say that you have a document
> like this:
>
> <MYDOC>
> <P xmlns="http://www.w3.org/TR/XHTML">This is supposed to be loose.</P>
> <P xmlns="http://www.w3.org/TR/XHTML">This is supposed to be strict.</P>
> </MYDOC>
>
> How would you select the schema to use for each?

I'll try to formulate the outline of a general solution (you did ask :-).

<Outline>

1. Allow a document to declare "I was created with the intention of
satisfying the following schema". A schema identification is a MIME type. I
know what the chances of all that are, so we'd probably see schemas named by
URIs. It doesn't really matter for the rest of the points.

For the people who claim that a document should not declare its own
stylesheet/schema/whatever - One must specify _something_ that allows the
application to know what document type this is. This is known, today, as a
MIME type. Why mix things up by inventing another typing system?

How the document is associated with a MIME type isn't really within XML's
realm. But just like HTML had add a META tag, even though HTTP is expected
to provide the relevant data, I'd expect there to be a directive which would
specify the meta information of an XML document (<?META?>) - be it a MIME
type, an XSchema, or whatever.

For Davig Megginson, who wants the same document to live under more then one
XSchema - (i) this problem applies to MIME types in general, bring it up
there; (ii) application are free to ignore a the document's specified meta
data and use a different one (they often do, anyway).

2. All of this has nothing whatsoever to do with namespaces. The XSchema
itself refers to names - and hence, makes use of namespaces to uniquely
define these names. Period. There's no other restriction of special
relationship between schemas and names.

3. Actually fetching the schema is a tricky matter. I have some notions but
that's not a critical issue - there are several obvious ways to tackle it;
I'm not going to fuss over it unless something twisted is suggested :-)

4. Given that Schemas can export and import stuff, the problem of
"modularization" is already solved. If you want to mix and match MathML with
XHTML and YourML, simple create your own super-schema which refers to these
three, and you are done. The power you'll have mixing pieces from different
schemas would depend on only one thing - the strength of the schema language
itself. Making intelligent use of namespaces reduces the need for powerful
constructs in this language - but does not remove the need altogether. I
fully trust the XSchema WG to come up with an adequate set of constructs, if
they put their mind to it.

</Outline>

With regard to your sample document. The application won't to be able to
distinguish between two 'p' elements unless there was _something_ different
about them. This something might be anything at all expressible in the
XSchema language. For example, suppose I could say in an XSchema "if attr
'A' contains 'VALUE', the element obeys a rule from this schema, otherwise a
rule from that schema" then your document would look like:

<MYDOC>
<P xmlns="http://www.w3.org/TR/XHTML" type="loose">This is supposed to be
loose.</P>
<P xmlns="http://www.w3.org/TR/XHTML" type="strict">This is supposed to be
strict.</P>
</MYDOC>

A more typical example might be:

<MYDOC>
<xhtml:p xmlns="http://www.w3.org/TR/XHTML">
This is a paragraph with some
<math:equation>equation</math:equation>
in it.
</xhtml:p>
</MYDOC>

This would require that in an XSchema one would be able to say "the element
define in this schema may also contain the following attributes/elements".
Much simpler then your case, and demonstrates why namespaces are a great
help for mixing and matching.

<SideNote>
I fully agree with you on what should be done in XHTML for now, which is to
remove any reference to namespaces from the XHTML specs until this is
finalized in some recommendation. Only then, when we know how it is to be
done, should namespaces be added to the relevant drafts/recommendations.
Doing anything else is, IMVHO, irress^H^H^H^H^H^Hpremature.
</SideNote>

Share & Enjoy,

    Oren Ben-Kiki


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list