I'm not sure whether this goes in the XML or the Javascript forum but I guess its more Javascript because I want to read an XML file..
Anyway... I've got an XML file in this form:
<units>
<unit unitName=...>
<position time=... lat=... long=.../>
<position time=... lat=... long=.../>
...
</unit>
<unit unitName=...>
<position time=... lat=... long=.../>
<position time=... lat=... long=.../>
....
</unit>
....
</units>
And I want to write Javascript to extract these information.
So far I've got:
Expand|Select|Wrap|Line Numbers
- var xml = GXml.parse(data);
- var units = xml.documentElement.getElementsByTagName("unit");
- for (var i = 0; i < units.length; i++) {
- var unitName = units[i].getAttribute("unitName");
- ????
- }
Thanks for any help~!