How to split the xml(as of now it is String format) output using String To XML Node ?

Hi Knime Team,

 

I have a String Manipulation node output as below.

Row0 -  <one: xml>..xml contents1.</one: xml>

Row1 -  <two: xml>..xml contents2.</two: xml>

Row2 - <one: xml>..xml contents3.</one: xml>

Row3 - <two: xml>..xml contents4.</two: xml>

 

Next, I have given this to String to XML node as a Input inorder to get the xml formatted output.

Is there any way, can I able to split this xml and store into different columns.

e.g

column1 :                                                                    column2:

<one: xml>..xml contents1.</one: xml>                   <two: xml>..xml contents2.</two: xml>

<one: xml>..xml contents3.</one: xml>                   <two: xml>..xml contents4.</two: xml>

 

Kindly, provide the solution or suggestion to get the above output.

Thanks in advance.

 

Best Regards,

Velu

Hi Velu,

Great question. You're certainly correct that the first step is to convert the string column to an XML column using the 'String to XML' node. Once you've done this you can use the KNIME XPATH nodes. These were recently updated in the KNIME 2.12 release, so I would recommend using the 2.12.1 KNIME release if possible. Details here: https://tech.knime.org/whats-new-in-knime-212#XML

The Node Description for the XPATH node gives a good description of the options that you'll need to extract data from an XML file to create new rows, columns or collections.

Best,

Jon

Hi Velu,

you could extract the tag names "one" and "two" and use them as pivots (group on the content e.g. contents1, ...).

Cheers, Kilian

Hi Kilian,

Thanks for your reply.

 

Regards,

Velu