You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Samuel Zarza <sz...@cestel.es> on 2000/10/03 18:35:49 UTC
How to get a xml document (DOM) as string
Hello:
I'm writing a method that returns a Document (DOM) as string, but it doesn't work. What I'm doing wrong?
(xmlDocument is a well generated Document object before).
public String toXML() throws IOException {
Writer xmlString = new StringWriter();
OutputFormat output = new OutputFormat(xmlDocument);
output.setIndenting(false);
XMLSerializer x = new XMLSerializer(xmlString, output);
x.serialize(xmlDocument);
return xmlString.toString();
}
Any help would be appreciated.
----------------------------------------------------
Samuel Zarza Fernández
e-mail: szarza@cestel.es
-----------------------------------------------------