Best practice to serialize a org.w3c.dom.Document over RPC?

331 views
Skip to first unread message

Richard Kennard

unread,
Jul 5, 2010, 3:02:53 AM7/5/10
to Google Web Toolkit
Hi guys,

A (hopefully easy) question: what is the GWT 'best practice' to take a
server-side DOM built with org.w3c.dom.Document and pass it over RPC?

Clearly once on the client-side it needs to become a
com.google.gwt.xml.client.Document, and I can achieve this by
serializing to and from a String of XML, but is there a better way?
Something more performant that uses some built-in DOM serialization
capabilities?

Regards,

Richard.

Thomas Broyer

unread,
Jul 5, 2010, 4:30:42 AM7/5/10
to Google Web Toolkit


On 5 juil, 09:02, Richard Kennard <rich...@kennardconsulting.com>
wrote:
I doubt there would be anything more performant than XML
serialization. Particularly on the client-side, as this is done by the
browser, and not by some JavaScript code.

Harald Pehl

unread,
Jul 5, 2010, 5:10:40 AM7/5/10
to Google Web Toolkit
I agree with Thomas. XMLParser.parse(xmlString) uses the browsers xml
parser which should be reasonable fast.

If you want to further process the XML document (e.g. map it to POJOs)
feel free to take a look at Piriti: http://code.google.com/p/piriti/.
It's a little lib I wrote to map XML / JSON to POJOs using annotations
and deferred binding.

- Harald

Richard Kennard

unread,
Jul 5, 2010, 6:29:59 PM7/5/10
to Google Web Toolkit
Perfect! Thanks for the detailed and fast responses guys.

Richard.
Reply all
Reply to author
Forward
0 new messages