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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can get node names from xml input but not from extract xml with xpath.

If I read a file and create and read the node name for example:
"name(Product/child::node())" it returns the string of the product name. However when I read XML from a string coming from an SQL row, the same xpath statement gives me this message:
"Exception occurred evaluting XPath: The result of the XPath expression is not a Node. It was: Swap of type: java.lang.String"
I write each sql string to a file and then read it so that I can bypass this error but it is very inefficient. Is there a way around this error message?
Thanks
Labels (4)
3 Replies
Anonymous
Not applicable
Author

Hello
Can you give us an example of your file?
Best regards
Shong
Anonymous
Not applicable
Author

I am still busy looking into this Shong. I will be doing some testing and then I will respond and give screen prints.
cheers
Anonymous
Not applicable
Author

There are 2 scenarios that I have been testing, both using the same xml data stored as varchar in Sybase.
In the first instance if I extract the field and write to a file and then read the file using xml input, by default it is output as a single line I don't get the xpath results that I expect. If I format the line (using custom Java method) then xpath returns the correct results. In this output log notice the 2nd field is blank in the first output (single line xml), it has a value in the second output (formatted xml):
Xpath query for second value - " name(Product/child::node())"
63749282||||0.0|4.0|1.0|||MTM_FULL|2010-11-01+02:00
63749282|FRA||||||Trade||MTM_FULL|2010-11-01+02:00


When I run the same xpath query above using tExtractXMLField reading the same xml string from the database I get the following error:
Exception occurred evaluting XPath: The result of the XPath expression is not a Node. It was: 4.0 of type: java.lang.Double
I take it this has something to do with java parsing the xml file / nodes but can I get the value as a string or double some how?
Example of XML (with dummy data):
<<deleted>>