parser for xml-data?
Charles Frankston
cfranks at microsoft.com
Tue May 19 20:20:16 BST 1998
> -----Original Message-----
> From: rbourret at dvs1.informatik.tu-darmstadt.de
> [mailto:rbourret at dvs1.informatik.tu-darmstadt.de]
> Sent: Tuesday, May 19, 1998 1:34 AM
> To: xml-dev at ic.ac.uk; Charles Frankston
> Subject: RE: parser for xml-data?
> 1) How do you use multiple namespaces in a valid document?
> That is, if you have
> two separate DTDs (schemas), neither of which references
> elements in the other,
> how do you build a single valid document with both of them?
> Elements from the
> first DTD can't nest inside elements from the second DTD
> (because they aren't in
> the second DTD's grammar) and vice versa. The example in
> section 3.1 of the
> namespaces spec is well-formed, but the spec doesn't explain
> how it can be
> valid. Presumably, it doesn't match any of the DTDs
> presented as namespaces.
DTDs are not well-equipped to handle namespaces. It can technically be
done: for example, you could allow your outer DTD to have 'ANY' content.
XML-Data schemas are designed to integrate with namespaces:
<!-- Schema for xyz namespace -->
<elementType id="a">
<string/>
</elementType>
<!-- Schema for zyx namespace (in a separate file) -->
<?xml:namespace ns="xyz" prefix="x"?>
<elementType id="b">
<element type="x:a">
</elementType>
<!-- Instance file -->
<?xml:namespace ns="zyx" prefix="z"?>
<?xml:namespace ns="xyz" prefix="x"?>
<z:b>
<x:a/>
</z:b>
>
> 2) The src attribute in your namespace declaration does not
> point to a DTD; it
> points to an XML-Data file. While the namespace spec does
> not prohibit this, I
> had simply assumed that the schema would be a DTD. It would
> be nice if the
> namespace spec clarified that it does not impose any rules on
> the format of a
> namespace schema. This is important for validating parsers,
> as it means that
> namespace declarations are dependent on the parser's ability
> to read the
> particular schema format that is used. (And if a parser can
> read multiple
> schema formats, how does it know which one to use?)
>
Most of the XML-Data spec describes the rules of the XML-Data schema file.
The schema happens to use XML instance syntax, rather than the separate
grammar approach of DTDs. We think this is a big advantage -- you can use
all the tools you have for editing XML instance data to edit XML-Data
schemas.
> 3) Why is production [1] in the namespace spec:
>
> [1] NamespacePI ::= '<?xml:namespace' (S (PrefixDef | NSDef
> | SrcDef))+ '?>'
>
> instead of:
>
> [1] NamespacePI ::= '<?xml:namespace' S PrefixDef S NSDef
> (S SrcDef)? '?>'
>
> Is the ambiguity of the production, which needs to be
> qualified with the
> Required Parts constraint, worth the flexibility in the order
> of PrefixDef,
> NSDef, and SrcDef? My opinion is no.
The ns, prefix, and src parameters to a namespace PI look a lot like
attributes (although they are not in a formal sense). Since attributes in
XML do not have to be in a particular order, it would certainly be
surprising for people to discover that attributes in a namespace have to be
a particular order. You're suggesting that the syntax be made harder to use
in order to make the productions easier to author. I think this is a bad
tradeoff.
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/
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