[YML] RE: YML: A Grand Unification of SAX and DOM? (fwd)

Clark C. Evans clark.evans at manhattanproject.com
Sat Dec 4 18:52:10 GMT 1999

On Fri, 3 Dec 1999, Don Park wrote:
> What is the advantage of YML over these
> solutions?
> 3. Road Signs
> <element>
>   <sax:cache>true</sax:cache>
>   <foo>bar</foo>
>   <sax:cache>false</sax:cache>
> </element>

This structure does not seem to be 
recursive, given that I'm interpreting
it as I would a processing instruction.

> 2. Parental Guidence

> <element>
>   <sax:cache>
>     <foo>bar</foo>
>   </sax:cache> </element>
This *could* be logically equivalent 
depending upon your interpretation.
Consider this instead:
If the processor would provide random access
to <bar/>, then the answer is no -- this is
not the same as YML.
If, however, you use a keyword like this 
to denote that the _immediate children_ 
are placed into random access storage, 
then the answer is almost.  In addition, a 
mechanism is required to gaurentee that 
all of the random access children occur 
before the first sequential child.

> 1. Pockets
> <element>
>   <pocket:attributes>
>     <att>
>       <ch>val</ch>
>     </att>
>   </pocket:attributes>
>   <pocket:children>
>     <foo>
>       <pocket:text>bar</pocket:text>
>     </foo>
>   </pocket:children>
> </element>

First, I don't get what you had intended
with <pocket:text>bar</pocket:text>, so
let's consider this replaced with
<text>bar</text> to proceed.

If attributes/children means random/sequential
access, then, of the three, this is the
closest since there seems to be an implicit
requirement that all random access children
occur before sequential access children.

However, you did not use this construct
recursively -- <ch> and <text> were
not marked with the sequential/random
access distinction.  If this distinction 
were embedded into a binary syntax, then 
this type of problem would not occur.
So, here is the YML version of the above,
assuming sequential access for <ch>
and random access for <bar>.

Or, using syntax sugar:

  <element att=<ch>val</ch> >
    <foo text="bar" />

Major advantage here is that the doubly 
recursive syntax drives the processing 
choice as to collect attributes together 
and provide them via random access (DOM), 
or to provide them individually via 
sequential access (SAX).
I hope this moves things along!

Best Wishes,


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

More information about the Xml-dev mailing list