[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: [Question] How to do incremental parsing?

  • From: Lars Marius Garshol <larsga@g...>
  • To: "Xu, Mousheng (SEA)" <Mousheng.Xu@s...>
  • Date: Thu, 05 Jul 2001 02:58:31 +0200

incremental parsing

* Mousheng Xu
| 
| One way to get around the problem would be to read the XML file into
| memory gradually and when needed. I would like to build such a DOM
| parser, but I am not familiar with the design of the Xerces XML
| parsers. Could someone give me a suggestion on how to tackle on the
| problem?

There are two approaches to this problem that have not yet been
presented fully in this thread.


The first, which is the one I usually use for data-oriented XML, no
matter what the size of the input, is to create an object model for
your data as a set of classes. Then make a SAX application which
builds instances of of this data model from XML input.

For example, if your input is an RSS document, you should have classes
like Channel, NewsItem, and so on. The result of processing should be
a set of objects representing the input.

This solves the problem Anthony Coates mentioned, when the XML
structure has strong interrelations that make it difficult to work
with SAX's peephole view of the document.

If your dataset is large you need an object model implementation that
is able to deal with that, using an object-oriented database, an RDBMS
mapping tool or whatever.


The second is to use a tool that only builds fragments of the tree at
a time. Tools like Pyxie, XML::Twig, SAXON, minidom, easydom, and, I
think, Orchard, allow you to do this. Probably there are many more
that I don't remember right now. This approach can often make it
easier (though less performant) to build instances of an object model.

In some cases it can also make the object model unnecessary, if the
XML is sufficiently simple.

--Lars M.


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.