Hi Andreas!

Andreas Andersson schrieb am 07.03.2005 13:54 :
Is there a way of not getting the <?xml version="1.0" encoding="UTF-8"?>
part when exporting a document or node with asXML()?

I think, you have to write your own asXML-method, which sets setSuppressDeclaration(true) on the OutputFormat:


public void asXMLwithoutDecl(Node node, OutputStream out) throws Exception
{
        OutputFormat outformat = OutputFormat.createPrettyPrint();
        outformat.setSuppressDeclaration(true);
        XMLWriter writer = new XMLWriter(out, outformat);
        writer.write(node);
        writer.flush();
}

hth,
Michael


------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to