Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   problem: writing out an XML file always includes the commented DTD in the beginning. Why? (http://www.velocityreviews.com/forums/t141083-problem-writing-out-an-xml-file-always-includes-the-commented-dtd-in-the-beginning-why.html)

bronski 02-16-2005 11:43 AM

problem: writing out an XML file always includes the commented DTD in the beginning. Why?
 
My problem is, I use javax.xml.Transform to write out a modified
Document object to a file. It has a dtd, and it is included every time
in the written file, no matter what. Why? How do I get rid of the
behaviour?

Here's the code:

try {
// Create a transformer
Transformer xformer =
TransformerFactory.newInstance()
.newTransformer();

// Write the DOM document to a file
Source source = new DOMSource(doc);
File newFile = new File(foo.xml);
Result result = new StreamResult(newFile);
xformer.transform(source, result);
} catch (TransformerConfigurationException e) {
System.out.println(e.getMessage());
} catch (TransformerException e) {
System.out.println(e.getMessage());
}



All times are GMT. The time now is 04:40 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.