You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Mike Chan <yt...@aajc.hku.hk> on 2000/02/03 03:46:52 UTC

Create an XML doc from Java object

Hi All,

I've an idea of generating dynamic XML doc from java object.  I've
planned to use Xerces to create a DOM tree first and then traverse the
tree to print out the XML doc.  However, I don't if it is right to
create DOM tree with an external DTD like this:

         DocumentImpl docImpl = new DocumentImpl();
         Document doc = docImpl;
         DocumentType docType =
docImpl.createDocumentType("MY_DOC",null,"C:\\mydtd.dtd");
         doc.appendChild(docType);

Please help!

BTW, any other suggestion for achieving the same thing?

Mike