XML Column combiner: Option for omitting element name

I want to combine 2 XML columns but without creating an new element around them.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<Compound>
...
</Compound>

and

<?xml version="1.0" encoding="UTF-8"?>
<Version>  
...
</Version>

should be combined to

<?xml version="1.0" encoding="UTF-8"?>
<Compound>
...
</Compound>
<Version>  
...
</Version>

without the need for a surrounding element. However if I omit the element name the node will not configure. How can I ahcieve this? Or later remove the surrodunding element again?

 

The result you want to get is not a valid XML document. An XML document must have only a single root element and not two (Compound & Version). This is the reason why you need to specify a container element that forms the new root of the document.

True. That would be introduced in the next step with the Row combiner node adn the desired end result would be:

<?xml version="1.0" encoding="UTF-8"?>
<Library>
	<Compound>
	...From Row1...
	</Compound>
	<Version>  
	...From Row1...
	</Version>
	<Compound>
	...From Row2...
	</Compound>
	<Version>  
	...From Row2...
	</Version>
</Library>

Note that this is a format defined by a 3rd party application. So I must stick to it.

The Row Combiner also requires a surrounding element. Anyway it seems I can't get the desired result with the XML nodes only.

 

Solved by using XSLT node with info in below link:

 

http://bytes.com/topic/xml/answers/740775-xsl-trying-remove-element-only-but-keep-children-intact-without-manual-input

 

EDIT:

Or simpler approach is to string replace the element in a java snippet node

xml = xml.replace("<row>", "").replace("</row>", "");

 

I would like to open this discussion again with a feature request - to add the option “omit root element” in the native XML nodes (JSON to XML, XML Row Combiner, XML Column Combiner) similar to the option seen in the native JSON Nodes. Sometimes the user wishes to add a common root element in a later node to implement more complex xml structures.

3 Likes