Get xml value based on another value in javascript -
i have gml looks this:
<gml:featuremember> <a:location>abcd</a:location> <a:elevatedpoint> <gml:pos>44.0 1.2</gml:pos> <a:elevation uom="ft">23</a:elevation> </a:elevatedpoint> </gml:featuremember> <gml:featuremember> <a:location>efjh</a:location> <a:elevatedpoint> <gml:pos>33.3 -6.9</gml:pos> <a:elevation uom="ft">244</a:elevation> </a:elevatedpoint> </gml:featuremember>
i want gml:pos
based on value of a:location
. example, want position related location abcd
. i'm guessing using xpath way forward not sure start.
any appreciated. let me know if need more information.
update
this i've go far:
var positions = document.evaluate("/featuremember/location[abcd]/elevatedpoint/pos", xml, null, xpathresult.any_type, null);
never used xpath on gml, i'd do:
/featuremember/location[desired_value]/elevatedpoint/pos
keep in mind xml xpath syntax , have no idea how has gml, , return positions of nodes correct location.
Comments
Post a Comment