Skip to main content
Solved

XMLXQueryExtractor query

  • July 11, 2023
  • 3 replies
  • 73 views

nielsgerrits
VIP
Forum|alt.badge.img+60

 

Been trying to get this working for a while, but I have to surrender...

 

My XML:

<?xml version="1.0" encoding="UTF-16"?>
<Surface name="Zone 101_01.01_A_020!" desc="" xmlns="http://www.landxml.org/schema/LandXML-1.2">
<SourceData/>
<Definition surfType="TIN" area2DSurf="234921.542328654672" area3DSurf="238197.012906672346" elevMax="11.943587904916" elevMin="-3.839199295337">
<Pnts>
<P id="2">214609.472108227172 150506.362479594914 5.162708941504</P>
</Pnts>
</Definition>
</Surface>

The attribute I need is "Zone 101_01.01_A_020!".

 

Queries I tried:

/Surface/@name/string()
for $c in /Surface
return data($c/@name)
/Surface/@name

When I test in online extractors, it does work. When I remove the namespace it starts to work, but why?

I'm using FME Desktop 2021.2.6

Can someone please help?

Best answer by ebygomm

declare namespace x='http://www.landxml.org/schema/LandXML-1.2';
/x:Surface/@name/string()

 image

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.

3 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • Best Answer
  • July 11, 2023
declare namespace x='http://www.landxml.org/schema/LandXML-1.2';
/x:Surface/@name/string()

 image


nielsgerrits
VIP
Forum|alt.badge.img+60
  • Author
  • 2938 replies
  • July 11, 2023
declare namespace x='http://www.landxml.org/schema/LandXML-1.2';
/x:Surface/@name/string()

 image

thanks!


nielsgerrits
VIP
Forum|alt.badge.img+60
  • Author
  • 2938 replies
  • July 12, 2023

thanks!

Lesson learned, take more time to read the documentation more carefully, as it is described in the first example. 😅

 

Since the top-level node contains the namespace declaration 'xmlns', the namespace must be declared in the query and it must be used to specify every element.