Lists Home |
Date 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
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
Here's a link to XML-Writer:
Here's information on SAX 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:
All the best,
David Megginson, email@example.com, http://www.megginson.com/