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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

XML parsing and XML creation with Xpath queries problem

Hai,
i want to read values from input XML and needs to create output XML. i am facing some problems . i put my queries below if any one know please answer me.
InputXML:
<Article>
<Id>rfssee343433534534jdjc</Id>
<Title><!]></Title>
<AdTags>
<AdTag><!]></AdTag>
<AdTag><!]></AdTag>
<AdTag><!]></AdTag>
</AdTags>
<Data>
<Item>
<ItemEntityType>Image</ItemEntityType>
<ItemFilePath>/Image/mgptHFeghebbf.jpg</ItemFilePath>
</Item>
<Item>
<ItemEntityType>Image</ItemEntityType>
<ItemFilePath>/Image/mgptHFeghfrgtd.jpg</ItemFilePath>
</Item>
</Data>
</Article>

My queries:
1.when i read Title using XPATH query : Article/Title
I am getting data without CDATA. how can i get with CDATA.
2. To get AdTag's values i am using below XPATH Queries.
i) Article/AdTags/* --> returns only first AdTag value .
ii) Article/AdTags --> if i select with GetNodes option checked, schema type as object. returns Parent element <AdTags> and child elements.
But i am expecting only child elements with nodes. how can i get this.
3. i need to add new element in ItemId using ItemFilePath value it will be added next to I ItemFilePath element.

eg:
ItemFilePath=/Image/mgptHFeghebbf.jpg
ItemId=mgptHFeghebbf
How can i do this one?

I am using tFileInputXML and tAdvancedOutputXML components as of now.
Labels (3)
17 Replies
Anonymous
Not applicable
Author

Hi
I don't know why you put tFileList here.
You might see the following images to know more about loop linking.
Regards,
Pedro
Anonymous
Not applicable
Author

I have a directory which contains articles as xml files. i need to read each file from that directory and then process it . For this purpose i am using tFileList here. do u have any other idea to read files from directory.
Anonymous
Not applicable
Author

Hi
Child job:
tFileInputXML(loop AdTag)--main-------------------------------------------------------tFileOutputMSXML
tFileInputXML(loop Item)--main----tJavaRow(add ItemId column here)---main---------|
Main job:
tFileList --Iterate-->tRunjob(Child job)
Pass the current file path into child job.
Regards,
Pedro
Anonymous
Not applicable
Author

Hai,
i don't know how to pass xml file name value from main job to child job . i attached my job designs. please check it.
i added column xmlfile - ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")) in iteratetoFlow component.
Anonymous
Not applicable
Author

Hi
Main job:
tFileList---Iterate-->tRunJob
Add a context variable called context.new1 in child job.
Regards,
Pedro
Anonymous
Not applicable
Author

Hai,
Adding context variable disabled in my talend . i am using Talend open studio big data 5.1.0 .
Anonymous
Not applicable
Author

Hi
Even though you are using TOS for BD, it is allowed to add context variable.
See the following image.
Then you are able to click on "+" button on tRunjob.
Regards,
Pedro
Anonymous
Not applicable
Author

my input/output xml having more inner level nodes. finally i got out put with tMap component and some custom routines functions.
can you tell me how to POST my output XML as a Stream to REST URL services.