Hi,

I am relatively new to DOM and I face an issue while parsing a document. 

I have a small application that reads an XML file with the following  lines:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article PUBLIC
"-//Client//DTD Journal//EN" "journal.dtd" []>
<article>
.
.
.
</article>


My application uses the Apache DOMParser to read this XML document which it
parses and adds an attribute to the <article> element. At the end the
modified document is printed out in a new file. The insertion of the
attribute works fine but the output file does not have the <!DOCTYPE...>
part anymore. My code looks like:


        import org.apache.xerces.parsers.DOMParser;


        String file = "c:/tmp/file1.xml";
        DOMParser parser = new DOMParser();
        parser.setFeature("http://xml.org/sax/features/validation";, true);
        parser.setFeature("http://xml.org/sax/features/namespaces";, false);
        parser.parse(file);
        Document srcDocument = parser.getDocument();


I would appreciate any suggestions/ideas.

Thanks,

Christos







_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to