Skip to main content

Hello,

I'm trying to create a kml-file using the xml-templater. In the kml file I want to visualize points and Lines, something like:

<Placemark>

 

<styleUrl>#Icon</styleUrl>

 

<Point>

 

<coordinates>{fme:get-attribute("rw_wgs84")},{fme:get-attribute("hw_wgs84")}</coordinates>

 

</Point>

 

</Placemark>

 

<Placemark>

 

<LineString><coordinates>{fme:get-attribute("_coordinates")}</coordinates></LineString>

 

</Placemark>

But I get an syntax error (missing comma between the Placemarks)?

What Am I doing wrong? How can I create a template for different placemarks?

Thanks for your help,

Isabell

For repeating tags such as multiple instances of Placemark, I'd recommend using the sub-templates and not the root template.

I recommend the help for the XMLTemplater, it's really thorough and covers a lot of use cases.


Hi @isi, an XML template expression can return a single XML element or a single sequence that contains multiple XML elements, and comma separated multiple XML elements can be considered as a sequence. Since you are going to create two <Placemark> elements (i.e. sibling elements without parent), you will have to separate them with a comma.

Note that the result will be just a string containing two <Placemark> elements, and it cannot be treated as a single XML fragment in the subsequent process.


Thank you for your answer! Now it works!


Thank you for your anwer! Now it works!


Reply