diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-05-02 22:35:38 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-05-02 22:35:38 +1200 |
commit | c53fdd16d37761c77005519b47efef1a61b2c98f (patch) | |
tree | 9e5cc22064f94d105b70fe4f1e748fbab9900fcd /src/org/traccar/web/client/model/StateReader.java | |
parent | b34fe7b41653ddca35d53cff629db044d6c984a0 (diff) | |
download | trackermap-web-c53fdd16d37761c77005519b47efef1a61b2c98f.tar.gz trackermap-web-c53fdd16d37761c77005519b47efef1a61b2c98f.tar.bz2 trackermap-web-c53fdd16d37761c77005519b47efef1a61b2c98f.zip |
Fix XML parsing (fix #45)
Diffstat (limited to 'src/org/traccar/web/client/model/StateReader.java')
-rw-r--r-- | src/org/traccar/web/client/model/StateReader.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/org/traccar/web/client/model/StateReader.java b/src/org/traccar/web/client/model/StateReader.java index 667f474b..10ed9809 100644 --- a/src/org/traccar/web/client/model/StateReader.java +++ b/src/org/traccar/web/client/model/StateReader.java @@ -5,7 +5,10 @@ import java.util.List; import org.traccar.web.client.ApplicationContext; import org.traccar.web.shared.model.Position; -import org.traccar.web.shared.model.XmlParser; + +import com.google.gwt.xml.client.Node; +import com.google.gwt.xml.client.NodeList; +import com.google.gwt.xml.client.XMLParser; public class StateReader { @@ -31,8 +34,13 @@ public class StateReader { String other = position.getOther(); if (other != null) { - for (String key : XmlParser.enumerateElements(other)) { - state.add(new StateItem(key, XmlParser.getElement(other, key))); + try { + NodeList nodes = XMLParser.parse(other).getFirstChild().getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + Node node = nodes.item(i); + state.add(new StateItem(node.getNodeName(), node.getFirstChild().getNodeValue())); + } + } catch (Exception error) { } } |