Re: [xml] What is the advantage of a Reader vs a Parser?



Thanks - I was wondering if I was on the right track and I am made wiser
by listening.

I started suspecting the problem after the 800th line of code (and only
half done).  The context information in my application is quite dense
but I have no significant reason to worry about the memory itself, the
whole message is only about 800-1000 characters.  The variations were
killing me.

respectfully
BJ

On Thu, 2004-04-01 at 10:50, Kevin P. Fleming wrote:
BJ Chippindale wrote:

It also appears that if the XML is a control message in which the
meaning of lower levels depends on the context set in upper ones, the
reader is inconvenient.  Message "state" information has to be retained
and/or discarded for each node as it is processed.  For example:  An
address that is a "destination" is not treated the same as a "source"
but the node name is identical. So I have to retain state information
throughout the processing and it quickly becomes intractably dense code
(Which is why I started exploring the parsing in the first instance).  
It appears that the standard parsing model is better suited to this sort
of work, as the context is implicit in the position on the tree.  

This is classic state-machine programming, and you are right, it is more 
work up front than using an XML "parser". However, if the documents you 
are dealing with are large enough for memory consumption to matter, it 
can make a large difference in the app's memory usage.
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
NetworkAdvantageTM Corporation Ltd, Wellington, New Zealand. 
email:  bchippindale networkadvantage biz
web:  www.networkadvantage.biz
direct: +64-21-168 9372
office: +64-4-237 7716
fax: +64-4-237 6044
                    






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