Home > Software engineering >  talend tExtractXMLField returns same firstname instead of moving to next firstname tag
talend tExtractXMLField returns same firstname instead of moving to next firstname tag

Time:03-30

I have an the below xml file . My job is tFileInputXML--->tExtractXMLField--->tlog enter image description here

My tExtractXMLField is set as the below. It keeps returning the Only the first firstname for all the other rows instead of the expected results. How can I set it to return only

enter image description here enter image description here

<root><status>success</status><data><users><firstname>Abby</firstname>
      <book><name>ABC</name> 
          <state><complete>true</complete></state>
      </book>
      <book><name>ZZZ</name>
          <state><complete>true</complete></state>
      </book> 
  </users>
  <users><firstname>Abdul</firstname>
     <book><name>SeeSaw</name>           
          <state><complete>true</complete></state>
     </book>
     <book><name>WWW</name>
          <state><complete>true</complete></state>
     </book>
   </users>
 </data>

}

CodePudding user response:

your xpath syntax is not correct. You have based your loop element on "book". "firstname" and "book" being on the same level, if you want to access it you first have to move to the upper node. use "../firstname" instead.

  • Related