Problem with parser from XML to String on GWT

134 views
Skip to first unread message

Crease

unread,
Dec 20, 2012, 11:32:04 AM12/20/12
to google-we...@googlegroups.com
Hi,
I have a problem when I try parser from XML to String on GWT. In other application that it´s not GWT, I don´t have problem and I make correctly. I´m reading but I don´t find any solution.
The next code work well, but It don´t work on GWT.

-------------------------------------------------------------------------------------------
//Construction of the XML file on DOM
...

XMLSerializer xmlSerializer = new XMLSerializer();
StringWriter strWriter = new StringWriter();
OutputFormat outFormat = new OutputFormat();

outFormat.setEncoding("UTF-8");
//outFormat.setEncoding("ISO-8859-1");
outFormat.setVersion("1.0");
outFormat.setIndenting(true);

outFormat.setIndent(4);
//outFormat.setIndent(2);
outFormat.setOmitXMLDeclaration(false);

outFormat.setMethod("xml");


xmlSerializer.setOutputCharStream(strWriter);
xmlSerializer.setOutputFormat(outFormat1);
//xmlDoc es el Documento (Document) XML
xmlSerializer.serialize(xmlDoc);
strWriter.close();

//And strWriter.toString() have the xml document convert to string

-------------------------------------------------------------------------------------------

In GWT give me a mistake because I cann´t import its librery. It show the next message of mistake:

Exclude "name my class.java" from App Engine validation

Thanks



Jeffrey Chimene

unread,
Dec 20, 2012, 5:24:00 PM12/20/12
to google-we...@googlegroups.com
On 12/20/2012 09:32 AM, Crease wrote:
> Hi,
> I have a problem when I try parser from XML to String on GWT. In other
> application that it�s not GWT, I don�t have problem and I make
> correctly. I�m reading but I don�t find any solution.
> The next code work well, but It don�t work on GWT.

These classes (XMLSerializer, StringWriter, OutputFormat) aren't
supported by GWT. Did you check the documentation?
https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation
> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/zRLptuwIwrkJ.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

Jens

unread,
Dec 20, 2012, 6:06:55 PM12/20/12
to google-we...@googlegroups.com

Crease

unread,
Jan 8, 2013, 4:37:00 AM1/8/13
to google-we...@googlegroups.com
Thanks for your answer,

Do you know any way of write a file XML to String in GWT? I know make it in java with XMLSerializer, StringWriter, OutputFormat but I look for as make it and I don´t find it.
If you know make it, I thanks you for explain me.

Postscript: I sorry for my english.

Thanks.


El jueves, 20 de diciembre de 2012 23:24:00 UTC+1, jchimene escribió:
On 12/20/2012 09:32 AM, Crease wrote:
> Hi,
> I have a problem when I try parser from XML to String on GWT. In other
> application that it�s not GWT, I don�t have problem and I make
> correctly. I�m reading but I don�t find any solution.
> The next code work well, but It don�t work on GWT.

These classes (XMLSerializer, StringWriter, OutputFormat) aren't
supported by GWT. Did you check the documentation?
https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation

>
> -------------------------------------------------------------------------------------------
> //Construction of the XML file on DOM
> ...
>
> XMLSerializer xmlSerializer = new XMLSerializer();
> StringWriter strWriter = new StringWriter();
> OutputFormat outFormat = new OutputFormat();
>
> outFormat.setEncoding("UTF-8");
> //outFormat.setEncoding("ISO-8859-1");
> outFormat.setVersion("1.0");
> outFormat.setIndenting(true);
>
> outFormat.setIndent(4);
> //outFormat.setIndent(2);
> outFormat.setOmitXMLDeclaration(false);
>
> outFormat.setMethod("xml");
>
>
> xmlSerializer.setOutputCharStream(strWriter);
> xmlSerializer.setOutputFormat(outFormat1);
> //xmlDoc es el Documento (Document) XML
> xmlSerializer.serialize(xmlDoc);
> strWriter.close();
>
> //And strWriter.toString() have the xml document convert to string
>
> -------------------------------------------------------------------------------------------
>
> In GWT give me a mistake because I cann�t import its librery. It show
> the next message of mistake:
>
> Exclude "name my class.java" from App Engine validation
>
> Thanks
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/zRLptuwIwrkJ.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages