You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Keith Pajkowski <Ke...@T1Xpert.com> on 2000/05/31 20:26:29 UTC
building DOM tree from scratch
We want to convert a data structure to an XML equivalent on the fly, i.e.,
build a DOM tree without actually reading in an XML document. The only
example of this I can find is written in XML4J and made use of the (now
deprecated) class TXDocument. In this example the completed document was
output using the instruction:
((TXDocument)doc).printWithFormat(new PrintWriter(System.out));
I looked at the DOMWriter.java example in the latest XerxesJ release. When I
try to output the XML document using OutputStreamWriter, XercesJ prints the
message:
[#document: null]
Sun's jaxp will not even compile the class, citing "Can't convert
org.w3c.dom.Document to char[]".
Any references you can send would be much appreciated.
Keith Pajkowski
T1Xpert.com
212 771 1059
Re: building DOM tree from scratch
Posted by "K.C. Jones" <kj...@phoenix-pop.com>.
Keith,
If you can stomach working with pre-release code, you might
consider JDOM. (http://www.jdom.org/docs/faq.html)
Using JDOM you can 'convert' your data structure to an XML
document, then 'convert' that XML to a DOM tree. Unless you
need the XML file, you needn't ever file it out.
Something to consider.
Cheers,
KC