Skip to main content
Question

How to build a XQuery for extracting values from XML

  • May 23, 2023
  • 1 reply
  • 151 views

juanmahere
Supporter
Forum|alt.badge.img+13

Hi,

I think the best FME Transfomer for such type of extractions is the "XMLXQueryExtractor", but I do not know how to build the query.

The XML is contained within an attribute and could be something like this:

 

"<?xml version="1.0" encoding="UTF-16"?><value xmlns="http://spec.tn-its.eu/schemas/"> <gml:measure uom="kph" xmlns:gml="http://www.opengis.net/gml/3.2">50</gml:measure> </value>"

 

For that particular case, I wanted to extract that "50" value from that XML.

Thanks!

 

 

 

1 reply

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3422 replies
  • May 23, 2023

So something like this should work, where XML Input is Attribute specifying XML

declare namespace gml='http://www.opengis.net/gml/3.2';
//gml:measure/text()

Unfortunately, my knowledge of xml and xquery is fairly limited so I can't really explain how or why you'd arrive at this answer!