[
Lists Home |
Date Index |
Thread Index
]
- From: Paul Tchistopolskii <paul@qub.com>
- To: xml-dev@ic.ac.uk
- Date: Thu, 02 Dec 1999 21:05:39 -0800
The advantage of SAX ( and attributes in XML)
is that we have attributes in place when startElement
is invoked. We know what are some properties of this
element right when element begins.
At that point could we get the information about
the another properties this element has
( the child elements ) ?
No. We can not. If we'l decide to read the entire
element before infoking startElement() - we'l have
to read the entire ( root ) document to know.
DOM does it.
How can we workaround this limitation?
Right now I'm writing yet another wrapper
around SAX, accumulating the element contents
in 'microDOM' and then making a descision in
endElement() what to do with the element
itself depending on the values of his children.
The 'correct' approach to avoid such a hell
is to use DOM - but I can't. Documents could
be big.
I also can not require the client to turn all their
elements into attributes.
It's actualy very interesting. If one wants his
XML documents to be easy to process
without DOM he should have as much attributes
as it's possible !
<aside>
Isn't it the end of long discussion of Elements vs Attributes?
Now when I see the question: "Should I use attributes or
elements?" - I know the answer:
"If you want it to be processed by current APIs not keeping
the entire docuemnt in the memory - use attributes everywhere
you can."
</aside>
What if for *some* elements parser would invoke
startElement ( or endElement) *after* reading the
entire element and placing all the children into ... Grove) ?
I think I could specify those 'return-as-grove' elements
at runtime, or when I'm initializing the parser.
How easy is to it do with curent SAX design ?
Rgds.Paul.
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@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@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|