Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
spr654
Creator
Creator

In Talend Open Studio, I have an XML Node without id: how can I set it?

Hi,

I am using Open Studio 7.1 to compare xml files with JSONB files. 

I have an xml that contains a list of entities.

Each entity has a name.

Each entity has one or several entries.

The entries don't have a name or a value, nothing to identify them.

Each entry can have one or more dataitems

Each entry can have recursive dataGroups

Each entry can have a list of descriptions, containing a number of translations

I need to compare this file with a JSON file that does represent one of my entries.

 

Issue 1: so far, I got to extract the descriptions with the translations of a given entry (if it does have one), with general information plus the name of the entity.

 

BUT I don't know how to include a number or id for the entry, so I know that the descriptions belong to entity1, entry1. Does anybody have a solution?

 

Issue 2: I want to check all the entries, even if they have no lsdlist, But if I put the loop at Entry level, I won't get the ldslist.

 

Issue 3: I have 4 loops: entry, dataitem, datagroup (recursive...) and lsdlis, and I don't know to to chain them so I know that this entry contains theses dataitems, these datagroups and these lsdlists.  

 

Any help is welcome.

 

Here is the root loop I use is: 

ReferenceDataRespMsg/RDEntityList/RDEntity/RDEntry/LsdList/description

 

Here is the metadata:

0683p000009M4r7.png

Here is the tFileInputXml:

0683p000009M53H.png

Here is the job (only one entry had lsdList, but I cannot even tell because no way to distinguish entries):

0683p000009M4vs.png

 

The file I have used is in attachment.

 

Labels (5)
1 Solution

Accepted Solutions
spr654
Creator
Creator
Author

I found the solution. The ids should be:

 

For entity: "count(ancestor::RDEntity/preceding-sibling::RDEntity) + 1"

For entry: "count(ancestor::RDEntry/preceding-sibling::RDEntry) + 1"

View solution in original post

2 Replies
nfz11
Creator III
Creator III

Try the Xpath index-of function.

 

Something like this:

 

entryNumber "index-of(../../RDEntry)"

 

I am not sure of the exact syntax.

 

You could also look at the position() function.

spr654
Creator
Creator
Author

I found the solution. The ids should be:

 

For entity: "count(ancestor::RDEntity/preceding-sibling::RDEntity) + 1"

For entry: "count(ancestor::RDEntry/preceding-sibling::RDEntry) + 1"