Skip to main content
Solved

Extract value with XMLXQueryExtractor.

  • May 6, 2021
  • 2 replies
  • 68 views

nielsgerrits
VIP
Forum|alt.badge.img+62

I have a hard time to get the XMLXQueryExtractor to do what I need. I wish it was more simple like JSON :-)

I want to extract the value 2.2 from this sample:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Leveringsinformatie xmlns="http://www.kadaster.nl/schemas/klic/leveringsinformatie/v20180418" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml/3.2">
<version>2.2</version>
</Leveringsinformatie>

The documentation states I need to declare the namespace because the XML has a namespace. So I tried:

declare namespace x='http://www.kadaster.nl/schemas/klic/leveringsinformatie/v20180418';
string(//x:Leveringsinformatie/@version)

But no luck. I tried all kind of stuff but the only thing that comes close is:

declare namespace x='http://www.kadaster.nl/schemas/klic/leveringsinformatie/v20180418';
//x:version

But this returns the entire node, I can't get the value.

The easy way is to use the XMLFragmenter with the path 

Leveringsinformatie/version

but it does not feel correct. I think the XMLXQueryExtractor is the JSONExtractor equivalent, but maybe I'm wrong. Can anybody help me with this?

 

Best answer by ebygomm

This should work in the XMLXQueryExtractor

declare namespace x='http://www.kadaster.nl/schemas/klic/leveringsinformatie/v20180418';
//x:version/text()

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • Best Answer
  • May 6, 2021

This should work in the XMLXQueryExtractor

declare namespace x='http://www.kadaster.nl/schemas/klic/leveringsinformatie/v20180418';
//x:version/text()

 


nielsgerrits
VIP
Forum|alt.badge.img+62

This should work in the XMLXQueryExtractor

declare namespace x='http://www.kadaster.nl/schemas/klic/leveringsinformatie/v20180418';
//x:version/text()

 

Thanks!