How do i get google xml tags?

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

How do i get google xml tags?

Postby spoortigandhad » Mon Apr 11, 2011 7:09 am

Hi all,

I'm developing android Travel app. I want to display nearest hotels, restaurants etc. from current location. Is it possible to get google xml tags for parsing?

Thank you.
spoortigandhad
Junior Developer
Junior Developer
 
Posts: 10
Joined: Mon Apr 11, 2011 6:28 am

Top

Re: How do i get google xml tags?

Postby Openxcell » Mon Apr 11, 2011 8:01 am

spoortigandhad wrote:Hi all,

I'm developing android Travel app. I want to display nearest hotels, restaurants etc. from current location. Is it possible to get google xml tags for parsing?

Thank you.



To extract the name of the sender, the subject line, and the message body from the XML. You can get some idea from this and you can write your own code for hotels & restaurants etc.

private void parseMessage(String messageXml) {
try {
// parse the XML document into a DOM
Document messageDom = XMLParser.parse(messageXml);

// find the sender's display name in an attribute of the <from> tag
Node fromNode = messageDom.getElementsByTagName("from").item(0);
String from = ((Element)fromNode).getAttribute("displayName");
fromLabel.setText(from);

// get the subject using Node's getNodeValue() function
String subject = messageDom.getElementsByTagName("subject").item(0).getFirstChild().getNodeValue();
subjectLabel.setText(subject);

// get the message body by explicitly casting to a Text node
Text bodyNode = (Text)messageDom.getElementsByTagName("body").item(0).getFirstChild();
String body = bodyNode.getData();
bodyLabel.setText(body);

} catch (DOMException e) {
Window.alert("Could not parse XML document.");
}
}
Openxcell
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Mon Mar 28, 2011 1:59 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: Google Feedfetcher and 4 guests