diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-01-27 18:15:09 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-01-27 18:15:09 +1300 |
commit | e49a792fcd72617122738891de67a39b386cb365 (patch) | |
tree | 8dd876daa5b5eae8ff9ec826fe659843cd931843 /src/org/traccar/web/client/Traccar.java | |
parent | 611494b77c8906d3fe7fd02039c5ede323b1fde4 (diff) | |
download | trackermap-web-e49a792fcd72617122738891de67a39b386cb365.tar.gz trackermap-web-e49a792fcd72617122738891de67a39b386cb365.tar.bz2 trackermap-web-e49a792fcd72617122738891de67a39b386cb365.zip |
Add simple XML parser
Diffstat (limited to 'src/org/traccar/web/client/Traccar.java')
-rw-r--r-- | src/org/traccar/web/client/Traccar.java | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/org/traccar/web/client/Traccar.java b/src/org/traccar/web/client/Traccar.java index 8fa67ecd..c596972d 100644 --- a/src/org/traccar/web/client/Traccar.java +++ b/src/org/traccar/web/client/Traccar.java @@ -16,14 +16,50 @@ package org.traccar.web.client; import org.traccar.web.client.controller.LoginController; +import org.traccar.web.shared.model.XmlParser; import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.xml.client.DOMException; +import com.google.gwt.xml.client.Document; +import com.google.gwt.xml.client.Node; +import com.google.gwt.xml.client.XMLParser; +import com.sencha.gxt.widget.core.client.box.AlertMessageBox; public class Traccar implements EntryPoint, LoginController.LoginHandler { @Override public void onModuleLoad() { - new LoginController().login(this); + //new LoginController().login(this); + + try { + String messageXml = "<a>1</a><b>2</b>"; + //parse the XML document into a DOM + String x = XmlParser.getElement(messageXml, "b"); + XmlParser.enumerateElements(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);*/ + + new AlertMessageBox("Info", "a=" + x).show(); + + } catch (DOMException e) { + new AlertMessageBox("Error", e.getMessage()).show(); + } } @Override |