|
PC2 & Ben, I am not sure SAX really "produces XML". Generally, you can use SAX to process an existing document. I have not spent enough time looking at the SAX API to see whether their is some mechanism to immediately serialize an event, but even if their is it would be really tricky to validate the document without adding a lot of overhead that SAX is supposed to avoid. SAX is basically an even-driven model -- as a document is read, it generates events that are passed to your program. Because of this it has a much smaller memory footprint than a DOM-based parser because DOM, which is tree-based, loads an entire document in memory during processing. The advantage with DOM is that you can randomly access information without spinning through the whole document. For what you describe, I would look at JDOM, which can return SAX events a document stream. This makes it pretty work well with other XML tools like XSL transformers and also makes it easy to create files. It will take up memory though, but it is a lot less memory intensive than XML4J or Xerces, because it is optimized to work with Java data types rather than the more esoteric W3C data types. David Morris >>> pclapham@core-mark.com 01/23/02 10:02AM >>> SAX is a sequential method of producing XML that doesn't require storing the whole document in memory. Roughly speaking you give the XML writer a series of events like "document starting", "Foo element starting", "Characters BAR", "Foo element ending", "document ending", and the writer outputs the equivalent well-formed XML. (This would fit very well with the RPG processing cycle if your XML structure was more than one level deep.) Regards PC2 -----Original Message----- From: Ben Akiba [mailto:asfour00@yahoo.com] Sent: January 23, 2002 08:53 To: java400-l@midrange.com Subject: RE: Creating XML document Paul, thanks a lot. This was very informative. Could you just throw a few more words on third option: SAX input to XML writer. Is that what JAXP is "suggesting"? Doesn't it involve DOM again?
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.