Skip to main content
Solved

XMLXQueryExtractor query


nielsgerrits
VIP
Forum|alt.badge.img+54

 

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

View original
Did this help you find an answer to your question?

3 replies

ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • 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+54
ebygomm wrote:
declare namespace x='http://www.landxml.org/schema/LandXML-1.2';
/x:Surface/@name/string()

 image

thanks!


nielsgerrits
VIP
Forum|alt.badge.img+54
nielsgerrits wrote:

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings