|
Jay Carlson wrote:
Why is this interesting? Trees are a natural data model to process XML documents. A simple tree implementation reads the entire document into memory at once. For large documents, this can be too expensive. Although callback and event APIs are memory-efficient, they are painful to program to. Lazynode constructs an conventional-seeming XML tree as its contents are referenced, parsing more source document as necessary to fill out the contents on demand.
I understand how this could save memory in a Lua table represent ion of an XML document. The "parsing more source document as necessary" is arguable. I've found it best to run an XML document through a validator like relax-ng before using it, relieving my program from the task of ad-hoc validation. Considering this, the XML often has already been parsed before your program gets to it.
-John -- http:// if ile.org/