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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Eric_Talend
Creator
Creator

[Resolved]Add a filter on an attribute in a XML File ?

Hello,

 

I have an XML file and I want to add a filter on my attribute.

 

My attribute is : status

 

 

0683p000009MaKd.png

 

I search on the web but I didn't find the solution.

 

0683p000009MaKi.png

 

How can I add a filter on my attribute "status" with the value "valid" ?

 

Many thanks

Eric.

Labels (2)
1 Solution
9 Replies
manodwhb
Champion II
Champion II

@Eric_Talend , one way is get the status colmn also in tfileinputxml and then use tfileterrows component to filter on status is valid.

Eric_Talend
Creator
Creator
Author

Hi,

 

thanks for your answer.

I understood your answer.

But I have a problem to extrat the value of the attibute.

 

I add the column "status"in my schema, it's OK but in the column "Request XPath", how I fill this column ?

Column                Request XPath

Status                   ??????????

 

I try "../catering", it's not ok

I try "../catering@status", it's not ok

I try "../catering/status", it's not ok

 

 

manodwhb
Champion II
Champion II

@Eric_Talend , can you try to use below one.

 

/cateringrate[@status="valid"]@status

Eric_Talend
Creator
Creator
Author

good !

 

I put "@status" and it's Ok and after, I add a filter in tXMLMap.s..

 

Thanks.

 

With tfileInputXML component, it's not possible to get an XML File ie https://mywebiste.com/xml ?

I had to copy my XML file to an local directory.

manodwhb
Champion II
Champion II

@Eric_Talend ,still do you have issues?

Eric_Talend
Creator
Creator
Author

Yes. Last one 🙂

 

You can see on the screenshot below that I use a local file : "/scratch/Documents/XML/restauration.xml"

 

So, I would like to open a XML file who is on Internet, for exemple this XML file :

https://www.w3schools.com/xml/note.xml

,

If I put "https://www.w3schools.com/xml/note.xml" instead of "/scratch/Documents/XML/restauration.xml", I have an error 😞

 

0683p000009MaKx.png

manodwhb
Champion II
Champion II

@Eric_Talend , if you need to read the data in xml from website you need to use tRest or Trestclient components.

Eric_Talend
Creator
Creator
Author

Ok, I will try during this afternoon and it works Smiley Very Happy

 

Many, many thanks.