OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Big XML file

[ Lists Home | Date Index | Thread Index ]

Miguel A. Robles writes:

 > Many thanks for your help. Now, I know I can manage large XML files
 > with SAX and it works fine. The problem now exists when I need to
 > update the content of an element or any of its attributes. I'm not
 > sure, but I think that SAX cannot be used for that purpose.

SAX per se is just a common interface, and cannot do anything.
However, there are SAX clients (like my own XML-Writer and probably
many better ones) that take SAX events and generate XML markup from
them.  So if you take a SAX parser and register a SAX writer as its
client, you have an XML identity transformation with only a few lines
of code.

Now, create your own filter to sit between the parser and the writer.
All your filter has to do is intercept the events it wants to change
and generate new ones to replace them.  That may be an easy or
difficult task, depending on the scope of the changes (i.e. renaming
or splitting a few elements is easy, restructuring a large subtree
isn't).

Here's a link to XML-Writer:

  http://www.megginson.com/Software/xml-writer-0.2.zip

Here's information on SAX filters:

  http://www.saxproject.org/?selected=filters

There are several good books that discuss techniques for programming
with SAX in Java, including (but not limited to) one by David Brownell
and one by Elliotte Rusty Harold:

  http://www.amazon.com/exec/obidos/tg/detail/-/0596002378/104-1533715-6226366

  http://www.amazon.com/exec/obidos/tg/detail/-/0201771861/104-4997920-1035102


All the best,


David

-- 
David Megginson, david@megginson.com, http://www.megginson.com/




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS