LPD
LPD

Reputation: 2883

Rendering XML data in GWT application

I have an XML object which comes as the response from a web service. I obtain the XML data using

Document xmlDoc = XMLParser.parse( response );

What is the easier and better way to render the xmlDoc in my DialogBox widget?

EDIT

Am having an XML object. I want to render the data inside a panel and show it on the GUI. Hope this helps.

To put in a better way,

Is it possible to directly add XML document to a panel in GWT, or we should parse the same and build the panel ourselves?

Thanks.

Upvotes: 2

Views: 162

Answers (1)

wonu wns
wonu wns

Reputation: 3608

you have to parse the web service response

Document messageDom = XMLParser.parse( response );

Then, you can get the node value by

String nodeValue = "";
final NodeList nlist = messageDom.getElementsByTagName( tagName );
if (nlist == null || nlist.getLength() <= 0) 
    nodeValue = "";
else 
    nodeValue = nlist.item(0).getFirstChild().getNodeValue();

from here, you can now set panel component value to nodeValue

Upvotes: 4

Related Questions