Four Stars

tFileInputXML parsing issue

I am using tFileInputXML  to parse XML files. 

 

My XML file looks similar to as below:

 

<organisation>

    <orgname>

            ABCD

    </orgname>

    <name>

            O sullivan

     </name>

     <address>

             <houseno>  123   </houseno>

             <street>par street </street>

             <state>Alabama </state>

    </address>

 

  

    <examdetails

          <subject> maths</subject>

                 <marks>70</marks>

          <subject>science</subject>

                  <marks> 20</marks>

   </examdetails>

 

 

 

Here, I define the Local XPath query as follows:

 

"/*[local-name()='organisation']/*[local-name()='address']/*[local-name()='street']"

 

 

 

the in Mapping:

 

column 'street', I use XPath Query as 'text()'

column 'exam' should provide me a value of true if the node 'subject is present in the XML file. Here there are two nodes with subject. How should I define the XPath Query for this. Some XML files do not have the node subject, in that case it should return false. All the XML files contains the node 'examdetails'.

 

whe I use the XPath query 

"../../../*[local-name()='examdetails']/*[local-name()='subject']"

for column exam, I am getting null. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

Re: tFileInputXML parsing issue

Hello,

Could you please try to set up xml metadata for your input file to see if it works?

Here is document about:TalendHelpCenter:Centralizing XML file metadata

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
1 REPLY
Moderator

Re: tFileInputXML parsing issue

Hello,

Could you please try to set up xml metadata for your input file to see if it works?

Here is document about:TalendHelpCenter:Centralizing XML file metadata

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.