Skip to main content
Solved

XML tag order and whitespaces

  • December 5, 2017
  • 5 replies
  • 67 views

lazarlubomir
Contributor
Forum|alt.badge.img+10

Hello everyone,

I try to export some XML data package via XML Templater. I have many conditions in tag filling and in cases, when tag is not filled, FME left there many whitespace, even if I use XML Formatter. You can check my syntax below:

The result is below of template is below:

Does anybody know, how to remove empty space and put object tag to the right level please?

Thank You so much!

Lubo

Best answer by david_r

The XMLFormatter has a setting called "Whitespace handling". Have you tried setting it to "Remove excess whitespace"?

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.

5 replies

takashi
Celebrity
  • 7843 replies
  • December 5, 2017

How have you set the "Whitespace Handling" parameter in the XMLFormatter?


david_r
Celebrity
  • 8394 replies
  • Best Answer
  • December 5, 2017

The XMLFormatter has a setting called "Whitespace handling". Have you tried setting it to "Remove excess whitespace"?


lazarlubomir
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • 165 replies
  • December 5, 2017

Thank You so much, my mistake :-( I missed this option and just reflected "Remove empty elements" and "Collapse empty elements"...


takashi
Celebrity
  • 7843 replies
  • December 5, 2017

Thank You so much, my mistake :-( I missed this option and just reflected "Remove empty elements" and "Collapse empty elements"...

Good to hear you found those options :-)

 

For what it's worth, this template expression

 

<objects>
  <object>
  {
  fme:get-attribute("value1")
  }
  </object>
  <object>{
  fme:get-attribute("value2")  
  }</object>
</objects>
generates this XML document.

 

<objects>
  <object>
  1
  </object>
  <object>2</object>
</objects>

takashi
Celebrity
  • 7843 replies
  • December 5, 2017
Good to hear you found those options :-)

 

For what it's worth, this template expression

 

<objects>
  <object>
  {
  fme:get-attribute("value1")
  }
  </object>
  <object>{
  fme:get-attribute("value2")  
  }</object>
</objects>
generates this XML document.

 

<objects>
  <object>
  1
  </object>
  <object>2</object>
</objects>
You can cast the long value to a string value with this syntax.

 

xs:string(<the long value>)