Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
However in the tFileInputXML_2, some value are found and some are not found (default value are assigned)
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...
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")
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.
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.
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.
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.
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...
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.
What component configuration do you want to see ? tFileInputXML_2 ? Basic settings ? Advanced ? Dynamic ?
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")
Oh ! It works by checking "ignore namespace" !
Why the namespace did this ?!