2

Possible Duplicate:
Java: How to Indent XML Generated by Transformer
jdbc export to xml - declaration showing standalone = no

      TransformerFactory factory = TransformerFactory.newInstance();
      Transformer transformer = factory.newTransformer();
      String outputPathname = "output.xml";
      StreamResult result = new StreamResult(new File(outputPathname));
      Source source = new DOMSource(dataDoc);
      transformer.transform(source, result);

I need to use jdbc to export data into a specific structured xml document. I'm using the parsing approach. I need the top to show

    <?xml version="1.0" standalone="yes"?> 

However, the file create actually shows

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>. 

How can I modify the code to achieve the desired form?

Community
  • 1
  • 1
zoe
  • 905
  • 5
  • 12
  • 18

0 Answers0