I am trying to do a foreach using xPath. It's working fine and looping through the XML.
My question is can I somehow use a while statement with it. I basically need to find each value of a certain attribute but not for the entire XML. I want the foreach to stop once it hits a certain attribute.
Example:
<InvoiceRet>
<TxnID>23827-1290392819</TxnID>
<TimeCreated>2010-11-21T21:26:59-05:00</TimeCreated>
<InvoiceLineRet>
<TxnLineID>23829-1290392819</TxnLineID>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>2382A-1290392819</TxnLineID>
</InvoiceLineRet>
</InvoiceRet>
<InvoiceRet>
<TxnID>2382F-1290392820</TxnID>
<InvoiceLineRet>
<TxnLineID>2382B-1290392819</TxnLineID>
</InvoiceLineRet>
<InvoiceLineRet>
<TxnLineID>2382B-1290392819</TxnLineID>
</InvoiceLineRet>
</InvoiceRet>
I basically need to loop through the first set of but not the second set. So I was hoping that I can stop the loop when it hits the second .
The problem is I have no idea how to do it.
Any help would be great.
Thanks!