I'm generating an xml document from scratch using a DOM created with user input. I can't find a way to create the DOCTYPE element. Any suggestions?
SAFROLE M3
Greenhorn
Joined: Jun 28, 2001
Posts: 18
posted
0
I dont think there is a method you can call to set the DOCTYPE using DOM, but there is no need to. In your application, you can create an in-memory DOM by reading a text file that acts as a template for you XML document. In other words, your text file would contain the bare bones for the XML document, including the DOCTYPE, such as... <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sample SYSTEM "dt.dtd"> <root> </root> So, after you read the text file, you have a DOM representation of your basic XML document, including the DOCTYPE, and you can add nodes to the document from the user input. Hope that helps you, SAF