On 20 June 2012 13:08, Natarajan V <[email protected]> wrote:
> On Wed, Jun 20, 2012 at 12:33 PM, Yogesh Girikumar
> <[email protected]> wrote:
>> Which is better to process streaming XML? (e.g. RSS)  SAX or DOM? Why?
> Is your XML of unlimited size and keeps streaming in? Or is it a tiny
> XML such as those RSS in news websites?
>
> If it is continous and non-stop/ huge (of the order of 1 Mb), shy away from 
> DOM.

It is continuous stream that updates not-so-frequently.. But
eventually, in a over a span of several months, I expect the size
would reach MBs..

> Yes, DOM reads the entire XML, converts it into objects, and is very
> often implemented using a nested hash-map. It is quite heavy on
> memory. BUT, it is quite usefull in terms speed of development and the
> ability to enrich (edit) the XML. SAX on the otherhand is read only.
>
> DOM and SAX are not the only options. There is a StAX parser as well.

Initially I'll be doing a lot of reading than writing XML. So I guess
I'll stick with SAX. I don't know if there are any implementations for
Python.

> Also note, now a days, there are tools, at least in the Java & .NET
> world, where you supply a XML Schema, and the tool would create a
> corresponding object representation (Similar to a Struct in C). You
> can then import the generated code into your application and use a
> list [array] of the generated objects. It can read as well as create
> the XML. There won't be any code in your application to read the XMLs.
> These would be externalized into those XML libraries. Eg. JAXB.

Something like this would be very useful. Taking points from this,
I'll read up more.. Thank you !!

--
Y
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to