> rbourret@dvs1.informatik.tu-darmstadt.de wrote:
>=20
> > One possibility is that something in your XML document, such=20
> > as an attribute at=20
> > the root, would refer to the XML document containing the=20
> > XML-Data definition of=20
> > your grammar:
> >=20
> > <MyRoot Schema=3D"MyRootSchema.xml">
> > ...
> >=20
> > Another (uglier) possibility is that you use namespaces: the=20
> > XML-Data namespace=20
> > and the namespace your XML-Data data defines. I haven't=20
> > looked enough at either=20
> > the namespaces or XML-Data specs to be sure how this would=20
> > work, but it seems=20
> > the object structure might be something like:
> >=20
> > ...
> >=20
>=20
> Namespaces are intended to what you're asking for. I.e.:
>=20
> <?xml:namespace ns=3D"urn:mycompany:MyRootSchema"
> prefix=3D"myschema" src=3D"http://something/MyRootSchema.xml"?>
>=20
> I don't see why using a standardized solution is uglier than inventing =
your
> own namespace tag. This does require you to namespace qualify your =
instance
> information. I.e. the tags that come from the =
urn:mycompany:MyRootSchema
> would be something like <myschema:xyz>.
It looked ugly to me not because of using namespaces, but because I =
couldn't=20
figure out which namespace owned the root tag. My first guess was =
something=20
like this, which I think is a bit ugly, not to mention invalid:
Root object
XML-Data root
XML-data data...
Your data root
Your data...
I hadn't thought of your solution because I assumed namespace =
declarations=20
pointed to DTDs, not to any general schema mechanism. Several other =
questions /=20
comments about namespaces:
1) How do you use multiple namespaces in a valid document? That is, if =
you have=20
two separate DTDs (schemas), neither of which references elements in the =
other,=20
how do you build a single valid document with both of them? Elements =
from the=20
first DTD can't nest inside elements from the second DTD (because they =
aren't in=20
the second DTD's grammar) and vice versa. The example in section 3.1 of =
the=20
namespaces spec is well-formed, but the spec doesn't explain how it can =
be=20
valid. Presumably, it doesn't match any of the DTDs presented as =
namespaces.
2) The src attribute in your namespace declaration does not point to a =
DTD; it=20
points to an XML-Data file. While the namespace spec does not prohibit =
this, I=20
had simply assumed that the schema would be a DTD. It would be nice if =
the=20
namespace spec clarified that it does not impose any rules on the format =
of a=20
namespace schema. This is important for validating parsers, as it means =
that=20
namespace declarations are dependent on the parser's ability to read the =
=20
particular schema format that is used. (And if a parser can read =
multiple=20
schema formats, how does it know which one to use?)
3) Why is production [1] in the namespace spec:
[1] NamespacePI ::=3D '<?xml:namespace' (S (PrefixDef | NSDef | =
SrcDef))+ '?>'
instead of:
[1] NamespacePI ::=3D '<?xml:namespace' S PrefixDef S NSDef (S =
SrcDef)? '?>'
Is the ambiguity of the production, which needs to be qualified with the =
=20
Required Parts constraint, worth the flexibility in the order of =
PrefixDef,=20
NSDef, and SrcDef? My opinion is no.
-- Ron Bourret