[xml] [xpath] How to print xml fragment



Hello,
 
I hope someone can help me with this problem.
 
My input xml file has got a recurring structure "TransactionError" as follows:
 
......
  <TransactionErrorRecords>
   <TransactionError>
    <TransactionErrorReference>bbb</TransactionErrorReference>
    <TransactionErrorMessage>ccc</TransactionErrorMessage>
   </TransactionError>
   <TransactionError>
    <TransactionErrorReference>ddd</TransactionErrorReference>
    <TransactionErrorMessage>eee</TransactionErrorMessage>
   </TransactionError>
.......
  </TransactionErrorRecords>
 
I need to extract the content of the xml file (as a string) between each couple <TransactionError>,</TransactionError>, the two tags included.
So I basically need to be able to populate a string in a loop with
   <TransactionError>
    <TransactionErrorReference>bbb</TransactionErrorReference>
    <TransactionErrorMessage>ccc</TransactionErrorMessage>
   </TransactionError>
 
then with
 
   <TransactionError>
    <TransactionErrorReference>ddd</TransactionErrorReference>
    <TransactionErrorMessage>eee</TransactionErrorMessage>
   </TransactionError>
 
and so on
 
I can identify the nodeset (all TransactionError's) with an xpath _expression_ but then how can I get the string value? I've tried to use the xpath2.c example as a guide by printing cur->content when cur=TransactionError but it won't work.
 
Thanks in advance,
Massimo
 
 
 
 
   <TransactionError>
    <TransactionErrorReference>bbb</TransactionErrorReference>
    <TransactionErrorMessage>ccc</TransactionErrorMessage>
   </TransactionError>
 
then
   <TransactionError>
    <TransactionErrorReference>ddd</TransactionErrorReference>
    <TransactionErrorMessage>eee</TransactionErrorMessage>
   </TransactionError>



 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]