Generic XML document displayer (DOM is Good)

I got an updated version of a generic XML document displayer working in WebObjects this morning. Takes an XML document (source as a String) and parses it into a DOM Document.

Then, I have a recursive WOComponent that accepts a Node (say, the root node of the Document, perhaps?) and displays all Elements and Attributes in the hierarchy starting at that Node.

Works pretty well, and is reasonably fast. Once the classes are "warmed up", parsing a big document takes 50-100ms, with more time for display. Not too bad, but there's probably lots of room for improvement.

I need to figure out how to really ignore white space. I have set the factory to setIgnoresWhiteSpace(true), but that doesn't seem to work for some reason... I still get the padded lines and spaces/tabs between nested elements. I'll look into that a little more... I think it has something to do with not being able to locate a DTD/schema for the document...

comments powered by Disqus
Last updated: January 26, 2023