lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Title: RE: lazy xml teaser

Sometimes you don't have a complete tree to parse. This is the case with a jabber-xmlrpc project I worked on. In this case I had to do all kinds of funky things to the xml tree to parse it a node at a time.

I am intrigued by Jay's proposal.

-joe

-----Original Message-----
From: John Belmonte [mailto:john@neggie.net]
Sent: Monday, February 23, 2004 11:08 AM
To: Lua list
Subject: Re: lazy xml teaser


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/



- - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - -
This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.