You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by ba...@standardandpoors.com on 2001/03/30 22:28:07 UTC

Re: print an DOM


funny, I just been doing this.  Try:

       System.out.println("Parsing XML file: "+uri+"\n\n");
        DOMParser parser = new DOMParser();
        try{
                parser.parse(uri);
                Document doc = parser.getDocument();
                OutputFormat of = new OutputFormat(newDoc);
                of.setPreserveSpace(false);
                of.setIndent(5);
                of.setLineWidth(80);
                BufferedOutputStream oStream = new BufferedOutputStream(new
FileOutputStream("fileName"));
                XMLSerializer ser = new XMLSerializer(oStream,of);

                ser.serialize(doc);
                oStream.close();
            }

        }




jvelaga@bbo.com on 03/30/2001 03:03:08 PM


Please respond to xerces-j-user@xml.apache.org
                                                              
                                                              
                                                              
 To:      xerces-j-user@xml.apache.org                        
                                                              
 cc:      (bcc: Barry Nobel/IN/FIS)                           
                                                              
                                                              
                                                              
 Subject: print an DOM                                        
                                                              





Hello,

Just like sun parser has xmldocument.write(System.out) method to dump
DOM onto std output.
Is there any api or framework that can print DOM from xerces parser.

thanks