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

Re: Can XML Schemas do this?

subject identifier code
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:

		<value>some human readable string</value>

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.

Furthermore, if I extended the value element to contain child elements
(as might be plausible for i18n purposes such as ruby or directionality),
I would have to provide a DOM-like representation of them, whereas with
my present design I can just let the code handler capture the SAX events
for the child elements directly.

> Out of context, no (sorry for that). This snippet came from a section
> giving hints to write extensible Relax NG schemas and if this is
> important for you, I think that using "interleave" is really a thing to
> do.

I agree in that case, but really because RNG has no means of doing
group-style redefinition, only choice-style and interleave-style.
(The reason for this is that if a definition were group-redefined twice,
the order of application would be unclear, since RNG definitions are
inherently unordered.)

John Cowan   jcowan@r...  http://www.ccil.org/~cowan
Most languages are dramatically underdescribed, and at least one is 
dramatically overdescribed.  Still other languages are simultaneously 
overdescribed and underdescribed.  Welsh pertains to the third category.
        --Alan King


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.