OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] XML Schema considered harmful?

[ Lists Home | Date Index | Thread Index ]

> >From point 7:
>
> "In W3C XML Schema there is no way to specify what is allowed as the
> root element."
>
>
> I've probably completely missed the point here, but doesn't an XML Schema
> that only has one global element achieve the above? Maybe its a matter of
> semantics but that's how it's panned out in practice for me thus far.

Yes and no.  One of the several methods that parsers are allowed to use to
validate a document is by finding a global element declaration for the root
element.  If your parser is using this method, then a side-effect of having
only one global element declaration is that your parser will not be able to
validate the document if your root element does not match that global
element declaration. However, I think this is a workaround to a missing
feature, not (as far as I can tell) the intended use of global element
declarations.  And it has a significant cost: since element substitution
groups only work for global elements, if you adopt this workaround, you
effectively lose XML Schema's element substitution group feature.  For this
reason, many schemas use global element declarations for elements that
cannot be root elements. One example is the XML Schema schema for XML
Schemas.  The net result is that, simply by examining an XML Schema, I
cannot tell which elements are intended to be allowed as root elements.

> James is emphatic, and that is only natural, but his arguments paint
> issues as black and white (XML Schema = bad, RELAX NG = good) and my
> experience with XML Schema suggests shades of grey.

I won't attempt to deny that my perspective on the relative merits of RELAX
NG and XML Schema is highly biased!

James






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS