[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XML. SAX. Streaming processing with Groves.
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@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1 To unsubscribe, mailto:majordomo@i... the following message; unsubscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|