XPath node missing value problem

HI,

          I am trying to use XPath node to extract the elements from xml file. In XPath node i am trying to get the two elements from xml file and so i have attached two xml queries. I am pasting the xml here:


<bookstore>
<book rack="XX" bookTimeStamp="2012-04-18T23:54:26Z" bookFacility="AAAA">
<bookpathtrackInformation>
<bookId>A1</bookId>
<position>
<location rack="first" pos="26" value="47"/>
</position>
</bookpathtrackInformation>
</book>
<book rack="YY" bookTimeStamp="2012-04-18T23:54:33Z" bookFacility="BBBB">
<bookpathtrackInformation>
<bookId>A2</bookId>
<position>
<location rack="second" pos="27" value="47" colno="2"/>
</position>
</bookpathtrackInformation>
</book>
</bookstore>

XPath queries:

/bookstore/book/bookpathtrackInformation/bookId - to get the book id

/bookstore/book/bookpathtrackInformation/position/location/@colno - to get the column no

I am trying to see the output table which places null value in the first row of column table and '2' value in the second row of column table. But i got the reverse output and i don't know how the XPath node executes it. I am attaching the workflow and xml file here. Please help me to resolve this doubt.

Thanks,

Prasanna

Dear Prasanna,

the problem is that the two queries you entered in the xpath node work independently of each other. The first one finds a set [A1,A2] and the second one a set [2]

Both don't know of the relation inbetween the tree.

To resolve the issue, I would suggest to use two XPath nodes. The first one gets only the bookpathtrackinformation (/bookstore/book/bookpathtrackInformation) and the second one uses this xml to get the bookid and number.

Best regards, Iris

1 Like