Supress/ Delete empty Nodes in XML generated by xmlbuilder

Viewed 53

For my express server I'm using the npm xmlbuilder package. Because I'm generating the XML dynamically out of a array of JSON-objects, there is sometimes the case that a XML node is empty. I would like to know if there is a elegant solution provided by the package to ignore these empty tags in the final XML?

<example>
  <display_in_xml>Filled</display_in_xml>
  <dont_display_in_xml />
</example>

The only thing I found in the documentation is a parameter called "allowEmpty", but this is used to differentiate between <test_node></test_node> and self closing nodes <test_node />

0 Answers
Related