Question

I have trouble in manipulating XML file data in Acrobat JS. I already have a XML document and have read it.Now the XML is as below:

<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<mapData>
<busline>  
  <id>4</id>  
  <name>K222</name>
  <stationList>
  <station>  
  <name>FirstStation</name>
  <stationAnnotName>station</stationAnnotName>  
  <cordX>-309</cordX>   
  </station>  
  <station>  
  <name>222first</name>  
  <stationAnnotName>station3</stationAnnotName>
  <cordX>-315</cordX>  
  </station>  
  </stationList>  
</busline>  
<busline>  
  <id>5</id>  
  <name>K333</name>     <-----find busline name == K333 and delete this busline node
  <stationList>
  <station>  
  <name>ss</name>
  <stationAnnotName>station</stationAnnotName>  
  <cordX>-309</cordX>   
  </station>  
  <station>  
  <name>Target</name>    <-----query by this station name
  <stationAnnotName>station3</stationAnnotName>
  <cordX>*-315*</cordX>  <----need this value
  </station>  
  </stationList>  
</busline>
</mapData>
</xfa:data>

In Adobe Acrobat , we have a method call XMLData.applyXPath(oXML,sringXPath). Now I want to get the station node's cordX value which its name == Target. Other words , we have many different station nodes belongs to statinList->busline->mapData->(xfa:data?)

So how do I write the XPath to find it and if I want to delete the busline which it has a station node's name is Target.I will use color to make it clear.

So i need to get the station.cordX by its name(red color) delte the busline which busine.name == K333(blue color)

I'm appreciate your help. need your help as soon as possible.

Was it helpful?

Solution

You can retrieve all the stationlist whose name tag value is Target.

//busline/stationlist[name='Target']/name
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top