Skip to main content
Hi

 

Im experiencing issues trying to use GML in XMLTemplater.

 

 

Code:

 

 {fme:get-xml-attribute("_conc")}

 

 

Works fine for 

 

_conc = <xml:Point> ....... </xml:Point>

 

Prints nothing for

 

_conc = <gml:Point> ...... </gml:Point>

 

 

Perhaps this not supposed to work? In that cas is there a workaround?

 

 

Best regards
Hi

 

seems like a bug to me ... a bit of a hack would be to have a stringreplacer before and replace "gml:" with "gml-", do the stuff you need and at the very end another stringreplacer doing the opposite ...

Hi Flavio, thanks!

Yes.. I guess thats the way I need to go.. to bad there is also some 'xml' in the GML that should actually be typed 'xml' and also the other way around. So I  must be careful when replacing.

Ill also be really happy If someone from Safe could answer regarding possible bug.

 

Cheers
Bump :) Safe?
Hi all,

 

 

It turns out the namespace directive, at a minimum, is required if you are attempting to use the gml: construct in the XMLTemplater

 

 

_conc = <xml:Point xmlns:gml="http://www.opengis.net/gml/3.2"> ....... </xml:Point>

 

 

In addition, if you are extracting geometry from a feature to put into XML there is also a GeometryExtractor transformer which allows you to extract the geometry from the feature as a GML string.

Hello from the future :-)

The comments here actually solved my problem in building a comprehensive  XML with XmlTemplater. I also needed the GeometryExtractor to generate GML geometry, to be used in a sub template.

And I ran into the same problem about XML namespaces.

The trick is to add the necessary namespaces to the outermost tag in the sub template expression, otherwise the XmlTemplater fails as it validates the output.

<ler:mytag gml:id="mytag.{fme:get-attribute("ID")}"
xmlns:ler="http://data.gov.dk/schemas/LER/1/gml" xmlns:gml="http://www.opengis.net/gml/3.2">...

Just wanted to add my experience on this problem, hoping it will help someone else 7 years from now :-)


Reply