[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Can XML Schemas do this?

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


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.