Skip to main content
Question

XML Templater: create more placemarks (point and line) in a root template

  • October 30, 2017
  • 4 replies
  • 19 views

Forum|alt.badge.img

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

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.

4 replies

david_r
Celebrity
  • 8394 replies
  • October 30, 2017

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.


takashi
Celebrity
  • 7843 replies
  • October 30, 2017

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.


Forum|alt.badge.img
  • Author
  • 8 replies
  • November 6, 2017

Thank you for your answer! Now it works!


Forum|alt.badge.img
  • Author
  • 8 replies
  • November 6, 2017

Thank you for your anwer! Now it works!