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] Can XML Schemas do this?

[ Lists Home | Date Index | Thread Index ]

On Tue, 2003-01-21 at 18:52, John Cowan wrote:
> Eric van der Vlist scripsit:
> > I think that the additional complexity is overstated. SAX is my favorite
> > XML API and I find it much more robust (and only slightly more complex)
> > to never rely on the relative order of children elements. In the
> > frequent case where I want to build an object out of an element, I use
> > to create the object and assign the properties given as attributes on a
> > start element, assign properties independently for each child element
> > and do final tests and operations on end element. 
> But this is not true streaming: 


> you are using SAX in order to create
> your application-specific ?OM.  Where you do not have the capacity or the
> need to represent the document as a clump of objects, having a prescribed
> ordering can be quite useful.
> In one application, I have to process a stream of elements that look
> like this:
> 	<subject>
> 		<type>some-identifier</type>
> 		<code>some-other-identifier</code>
> 		<value>some human readable string</value>
> 	</subject>
> Declaratively speaking, a subject has a type, a code, and a value.  But by
> relying on the order, I can dispatch to separate handlers depending on
> the value of the type element, which can then pick up the value of the
> code and (if desired) the value of the value elements.  If they could
> occur in any order, I would have to buffer up the (possibly long) value
> element until I knew what, if anything, to do with it.

That's a good case, but I wouldn't call it exactly frequent... Note that
it could be fixed by a change in the design such as:

                <value>some human readable string</value>

I am not saying that there are no cases when the order should be fixed
but rather ranting against the fact that it's considered to be the best
choice "by default" and would rather tend to think that when all reasons
having been evaluated no specific order make more sense than any other
one which is very frequently the case, my prefered option is define an
unordered content model.

Curious about Relax NG? My book in progress is waiting for your review!
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema


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

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