Remove header from xml

Hi,

I have following XML data:

<?xml version="1.0" encoding="UTF-8"?>
<PAL2XML version="0.0.1">
    <record>
        <header>
             ……..
        </header>
        <measurements>
             ………
        </measurements>
    </record>
</PAL2XML>

I want to remove the first line from the xml and keep the datatype of the column xml. Is there a way to do it with KNIME nodes?
My application needs the first line to be <PAL2XML version="0.0.1">.

Regards,
Nithin

Hi @nithinth7

Did you try using the String Manipulation node? With some regex, you can probably remove the first line.

@nithinth7 I’ve edited your post to show the <PAL2XML version="0.0.1"> part at the end. It was not showing up as you hadn’t marked it as “preformatted” so the < > made it hidden.

I think that to hold this as an XML data type, there will always be the <xml > header. If this is just so you can use it with your application, why does it matter that it is an XML data type in KNIME? You could just hold your required data as a String. Is it because you need to be able to use XML Writer?

You can alternatively use String to Binary Objects node and use the Binary Objects to Files to write the xml file.

2 Likes

Yes, I have to use an XML writer to write the file in to MinIO. I will try out your solution :slight_smile:
Thank you

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.