Reputation: 283
I have a problem when I try converter a document (org.w3c.dom.Document) to String for GWT.
Bofer I developed it without to use GWT and I make like this:
XMLSerializer xmlSerializer = new XMLSerializer();
StringWriter strWriter = new StringWriter();
OutputFormat outFormat1 = new OutputFormat();
outFormat1.setEncoding("UTF-8");
//outFormat1.setEncoding("ISO-8859-1");
outFormat1.setVersion("1.0");
outFormat1.setIndenting(true);
outFormat1.setIndent(4);
//outFormat1.setIndent(2);
outFormat1.setOmitXMLDeclaration(false);
outFormat1.setMethod("xml");
xmlSerializer.setOutputCharStream(strWriter);
xmlSerializer.setOutputFormat(outFormat1);
xmlSerializer.serialize(xmlDoc);
strWriter.close();
But the application give a mistake because GWT don´t accept it.
Do someone know some other solution?
Thanks.
Upvotes: 1
Views: 395
Reputation: 9741
I guess you are trying to deal with xml documents in client side, right?
If so, you cannot use org.w3c.dom since it is not part of the subset of the java runtime library emulated by gwt.
To handle xml in client-side you have to use GWT XML parsers, or another client library, personally I prefer the gwtquery XML data-binding way.
Upvotes: 1