Please see attached XML file.
I am using the XPATH expression getValueXPath() in JavaScript to extract one value from an XML alert message - to control a robotic telescope.
I need to extract the value for Dec, a coordinate location in the sky that is a child of <WhereWhen>
The particular value I need to retrieve is green/bold in the below excerpt.
<WhereWhen>
<ObsDataLocation>
<ObservatoryLocation xlink:type="simple" xlink:href="ivo://STClib/Observatories#GEOLUN/" id="GEOLUN"/>
<ObservationLocation>
<AstroCoordSystem xlink:type="simple" xlink:href="ivo://STClib/CoordSys#UTC-FK5-GEO/" id="UTC-FK5-GEO"/>
<AstroCoords coord_system_id="UTC-FK5-GEO">
<Time unit="s">
<TimeInstant>
<ISOTime>2012-01-19T04:04:30.21</ISOTime>
</TimeInstant>
</Time>
<Position2D unit="deg">
<Name1>RA</Name1>
<Name2>Dec</Name2>
<Value2>
<C1>120.0271</C1>
[B]<C2>-9.0739</C2>[/B]
</Value2>
<Error2Radius>0.0500</Error2Radius>
</Position2D>
</AstroCoords>
</ObservationLocation>
</ObsDataLocation>
<Description>The RA,Dec coordinates are of the type: source_object.</Description>
</WhereWhen>
I have tried many variations on this expression, but have not been able to extract the value
dec = getValueXPath(XmlDoc, '/z:VOEvent/WhereWhen/ObsDataLocation/ObservationLocation/AstroCoords/Position2D/Dec');
What is the correct XPATH for this particular file and format?
Thank you in advance,
Tom Krajci