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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Practical example of SAX parser

I've found quite some topics on SAX parsing with tInputFileXML, but none really conclusive.
If I set up an XML in my metadata, everything is working fine with DOM parsing, but it won't work with SAX parsing.
SAX and Xpath can be tricky (though there are libraries out there to support Xpath when using SAX parsers), but as that doesn't seem to be supported in Talend, what's the use of offering a SAX parser anyway?
More to the point, how can I properly configure the tInputFileXML component to use SAX parsing, and still give me a result. Is there any proper guideline out there?
Labels (3)
4 Replies
Anonymous
Not applicable
Author

Hi
I have tested tFileInputXML with SAX mode and it works fine.
Do you encounter any error? Please show us.
Regards,
Pedro
Anonymous
Not applicable
Author

It's not that I get an error, just that there are no results.
The format of my XML is like this:
<results>
<result>
<binding name="result1">
<literal>Value 1</literal>
</binding>
<binding name="result2">
<literal>Value 2</literal>
</binding>
<binding name="result3">
<literal>Value 3</literal>
</binding>
<binding name="result4">
<literal>Value 4</literal>
</binding>
</result>
</results>

Looping follows this xpath: /results/result
And for retrieving the values, I use xpaths like binding/literal
With DOM it's working fine. For SAX, it does loop over the results, but doesn't extract the actual values. So for an XML file with a 100 <result> tags, I'll get a hundred empty results.
Anonymous
Not applicable
Author

Hi
Modify Loop Xpath query and Xpath query for each columns as the following image.
Then it will work fine with SAX mode.
Regards,
Pedro
Anonymous
Not applicable
Author

Hi pedro,
indeed that's working, though the result is a for each value a 'row', rather than encapsulating the different result1/2/3/4 into a single result 'object'.