# XML Column combiner: Option for omitting element name

**URL:** <https://forum.knime.com/t/xml-column-combiner-option-for-omitting-element-name/5766>\
**Category:** KNIME Analytics Platform\
**Created:** [June 18, 2014, 11:24am UTC](https://forum.knime.com/t/xml-column-combiner-option-for-omitting-element-name/5766 "2014-06-18T11:24:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![beginner](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/b/e495f1/32.png) [@beginner](https://forum.knime.com/u/beginner)\
**Post date:** [June 18, 2014, 11:24am UTC](https://forum.knime.com/t/xml-column-combiner-option-for-omitting-element-name/5766/1 "2014-06-18T11:24:50Z")

</div>

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?

&nbsp;

---

<div class="post-metadata">

**Author:** ![thor](https://forum-cdn.knime.com/user_avatar/forum.knime.com/thor/32/4_2.png) [@thor](https://forum.knime.com/u/thor)\
**Post date:** [June 18, 2014, 11:30am UTC](https://forum.knime.com/t/xml-column-combiner-option-for-omitting-element-name/5766/2 "2014-06-18T11:30:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![beginner](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/b/e495f1/32.png) [@beginner](https://forum.knime.com/u/beginner)\
**Post date:** [June 18, 2014, 12:11pm UTC](https://forum.knime.com/t/xml-column-combiner-option-for-omitting-element-name/5766/3 "2014-06-18T12:11:00Z")

</div>

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.

&nbsp;

---

<div class="post-metadata">

**Author:** ![beginner](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/b/e495f1/32.png) [@beginner](https://forum.knime.com/u/beginner)\
**Post date:** [June 18, 2014, 2:22pm UTC](https://forum.knime.com/t/xml-column-combiner-option-for-omitting-element-name/5766/4 "2014-06-18T14:22:27Z")

</div>

Solved by using XSLT node with info in below link:

&nbsp;

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

&nbsp;

EDIT:

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

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

&nbsp;

---

<div class="post-metadata">

**Author:** ![mwakileh](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mwakileh](https://forum.knime.com/u/mwakileh)\
**Post date:** [May 27, 2022, 4:40pm UTC](https://forum.knime.com/t/xml-column-combiner-option-for-omitting-element-name/5766/5 "2022-05-27T16:40:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [June 23, 2023, 8:22pm UTC](https://forum.knime.com/t/xml-column-combiner-option-for-omitting-element-name/5766/6 "2023-06-23T20:22:21Z")

</div>


