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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Extract Data from XML using tExtractXMLField

I need to Fetch the value of data from XML having multiple same elements :-
<Phones>
<ContactPhone>
<number>Example string value.</number>
<useType readonly="true">Home</useType>
</ContactPhone>
<ContactPhone>
<number>Example string value.</number>
<useType readonly="true">Work</useType>
</ContactPhone>
<ContactPhone>
<number>Example string value.</number>
<useType readonly="true">Pager</useType>
</ContactPhone>
<ContactPhone>
<number>Example string value.</number>
<useType readonly="true">Mobile</useType>
</ContactPhone>
<ContactPhone>
<number>Example string value.</number>
<useType readonly="true">Fax</useType>
</ContactPhone>

If UseType is Home the the Number in that ContactPhone is Extracted, else if UseType is Work the that Number should be extracted. How can i achive this , also the data is to fetched from API, SO there might be possibility the complete tags /phone number might not appear.
Labels (3)
2 Replies
Anonymous
Not applicable
Author

Hi,
You can extract all data from XML string with tExtractXMLField, and then filter the rows with tFilterRow or tMap component.
Best regards
Sabrina
Anonymous
Not applicable
Author

hi all,
as far as I know, tExtractXMLField use dom4j parser.
by that way you're able to use some filter in yout Xpath expression but could become 'touchy'.

regards
laurent