Three Stars

Tag's value not found in TFileInputXML

Hi,

 

I struggle to find the reason for my issue concerning the extraction of tag in a TFileInputXML.

 

First of all, here is a screenshot of the Job

 

Screen1.png

 

 

As you can see, there is 2 tFileInputXML. The XML in input file is the same ! The difference is in the tFileInputXML_2, there is a loop in multiple tag.

 

 

I run a traces debug and in the below screenshot, you can see all values in tFileInputXML_1

 

Screen2.png

 

However in the tFileInputXML_2, some value are found and some are not found (default value are assigned)

 

Screen3.png

 

I don't know why some values are not found. I already made jobs with 4 others XML format (different structure, different tag name) by copy/paste the job and only change the generic schema and the path to the tag but for this XML format, this incoherent behaviour happened and I don't know why...

1 ACCEPTED SOLUTION

Accepted Solutions
Fifteen Stars

Re: Tag's value not found in TFileInputXML

The Basic settings is where I think the issue may be. Although, there could be an issue with namespaces....but this would be reflected in both unless you (set "ignore namespace in one but not the other, for example")

Rilhia Solutions
10 REPLIES
Fifteen Stars

Re: Tag's value not found in TFileInputXML

My prediction is that your XPaths are not the same. You need to show us the component configuration for both XML components and give us an idea of what the XML looks like.

Rilhia Solutions
Three Stars

Re: Tag's value not found in TFileInputXML

Ok so for the example I will take the attribute Nadawca_EORI (you can see in the screenshot).

 

Here is a part of the XML structure :

 

<IE529>

|        <Zwolnienie>

|        |        ...

|        |        <Nadawca EORI="PL883159313600000" />

|        |        <Towar Nr="1" >

|        |        |        ...

|        |        </Towar>

|        |        <Towar Nr="2" >

|        |        |        ...

|        |        </Towar>

|        |        <Towar Nr="x" >

|        |        |        ...

|        |        </Towar>

|        |        ...

|        </Zwolnienie>

</IE529>

 

 

the loop is /IE529/Zwolnienie/Towar

the xpath for Nadawca_EORI is "../Nadawca/@EORI"

 

I did the same kind of path for others XML structure and tag name and I had never problem.

 

Three Stars

Re: Tag's value not found in TFileInputXML

Moreover, the xpath I have written in the response below is the xpath in the tFileInputXML_2

 

In the tFileInputXML_1, there is no loop and the xpath for Nadawca_EORI is "/IE529/Zwolnienie/Nadawca/@EORI" and as you can see in the screenshot, the value is found.

Fifteen Stars

Re: Tag's value not found in TFileInputXML

Yes, your XPaths are different and as such they are doing different things. The reason your second component is not working is likely because your relative XPaths to the Loop XPath are not accurate. It is difficult to give you more information than that I am afraid. 

Rilhia Solutions
Three Stars

Re: Tag's value not found in TFileInputXML

The xpath should be good. I'll give you another example (and compare it with the previous one)

 

Here is again the sample of the XML structure 

 

<IE529>

|        <Zwolnienie DataZwolnienia="2017-11-14T09:22:05">

|        |        ...

|        |        <Nadawca EORI="PL883159313600000" />

|        |        <Towar Nr="1" >

|        |        |        ...

|        |        </Towar>

|        |        <Towar Nr="2" >

|        |        |        ...

|        |        </Towar>

|        |        <Towar Nr="x" >

|        |        |        ...

|        |        </Towar>

|        |        ...

|        </Zwolnienie>

</IE529>

 

IE459 is the root.

As you can see in the screenshot above, the tag Nadawca_EORI is not found. Contrary to the tag DataZwolnienia which is found.

 

DataZwolnienia is an attribute of the tag <Zwolnienie> and Nadawca_EORI is an attribute of the tag <Nadawca>

 

The xpath loop is "/IE529/Zwolnienie/Towar"

 

As you can see in the structure, <Towar> is on the same level than <Nadawca>.

 

Here is the xpath of DataZwolnienia : "../@DataZwolnienia"

 

Here is the xpath of Nadawca_EORI : "../Nadawca/@EORI"

 

The xpath seems good given that DataZwolnieinia is found.

 

Moreover, all attributes in the tag <Zwolnienie> that I have to extract are found and all attributes in the tag <Nadawca> that I have to extract are not found. It is so weird...

Fifteen Stars

Re: Tag's value not found in TFileInputXML

It would be easier to just show screenshots of the component configurations. The rest is all theoretical if there is a mistake in the component configuration that you are not aware of.

Rilhia Solutions
Three Stars

Re: Tag's value not found in TFileInputXML

What component configuration do you want to see ? tFileInputXML_2 ? Basic settings ? Advanced ? Dynamic ?

Fifteen Stars

Re: Tag's value not found in TFileInputXML

The Basic settings is where I think the issue may be. Although, there could be an issue with namespaces....but this would be reflected in both unless you (set "ignore namespace in one but not the other, for example")

Rilhia Solutions
Three Stars

Re: Tag's value not found in TFileInputXML

Oh ! It works by checking "ignore namespace" ! Smiley Happy

Why the namespace did this ?!

Fifteen Stars

Re: Tag's value not found in TFileInputXML

Namespaces are important in XML to avoid name conflicts, but they add an extra element of complexity to XPaths. Sometimes you do not need them, in which case ignoring the namespaces will make your XPaths easier to write and understand. I assume your XPaths have omitted the namespace where they have failed.

Rilhia Solutions