problem: writing out an XML file always includes the commented DTD in the beginning. Why?

Discussion in 'Java' started by bronski, Feb 16, 2005.

  1. bronski

    bronski Guest

    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());
    }
     
    bronski, Feb 16, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim Heavey
    Replies:
    1
    Views:
    374
    Oisín Grehan
    Dec 2, 2003
  2. =?Utf-8?B?YWRvbGYgZ2FybGlj?=

    BUG: commented out server side controls in html still run

    =?Utf-8?B?YWRvbGYgZ2FybGlj?=, Nov 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    429
    John Saunders
    Nov 22, 2004
  3. test
    Replies:
    2
    Views:
    2,039
    Oliver Wong
    Jul 28, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,961
    Smokey Grindel
    Dec 2, 2006
  5. Jesse B.
    Replies:
    9
    Views:
    236
    Jesse B.
    Mar 27, 2010
Loading...

Share This Page