adiemeer
asked on
Xpath 1.0 function for Exists
I have the following XML:
I want to create two Xpath queries that return me the 'start' and 'end' elements for each B.
Problem is, I now end up with two arrays of different lengths: (60;63;61) and (65;67).
I want to be able to detect which B doesn't have an end-element.
Therefore I should use a function like 'exists' or something like that, but I can only use the Xpath 1.0 library.
Anybody that can help me with this?
<A>
<B>
<Amount>5000</Amount>
<Start>60</Start>
<End>65</End>
</B>
<B>
<Amount>3000</Amount>
<Start>63</Start>
</B>
<B>
<Amount>1234</Amount>
<Start>61</Start>
<End>67</End>
</B>
</A>
I want to create two Xpath queries that return me the 'start' and 'end' elements for each B.
Problem is, I now end up with two arrays of different lengths: (60;63;61) and (65;67).
I want to be able to detect which B doesn't have an end-element.
Therefore I should use a function like 'exists' or something like that, but I can only use the Xpath 1.0 library.
Anybody that can help me with this?
//B[not(End)]
ASKER
Thanks, this is helping me.
But how do I now construct the array of length 3? (With a dummy for the second element, f.i 65;999;67)
But how do I now construct the array of length 3? (With a dummy for the second element, f.i 65;999;67)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.