cancel
Showing results for 
Search instead for 
Did you mean: 

How to change XML file to exclude root tag

maarts
New Contributor II

I have a pipeline that runs as a taks and in the end outputs a XML file, like the following example. But I need to get the XML file without the <content> tags. Any help how to achieve that?

The XML output is:

<content>
     <soapenv:Envelope xmlns:StUF="http://www.egem.nl/StUF/StUF0301" xmlns:ns2="http://zig.nl/csb" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
          <soapenv:Body>
                <ns0:Fo02Bericht xmlns:ns0="http://www.egem.nl/StUF/StUF0301">
                    <ns0:stuurgegevens>
                           <ns0:berichtcode>Fo02</ns0:berichtcode>
                    </ns0:stuurgegevens>
               </ns0:Fo02Bericht>
         </soapenv:Body>
    </soapenv:Envelope>
</content>

1 ACCEPTED SOLUTION

I found the solution in using the Mapper snap and using a specific level assigned to $content with a binary output for the Mapper Snap. Works like a charm.

View solution in original post

3 REPLIES 3

bojanvelevski
Valued Contributor

Hi @maarts 

You can parse the XML with an XML Parser. The output will be JSON which you can easily re-map (remove the content object). After the transformation, use XML Formatter to turn the JSON into an XML again. Tested it, and it works. Try this and let us know the outcome.

Regards,

Bojan

I found the solution in using the Mapper snap and using a specific level assigned to $content with a binary output for the Mapper Snap. Works like a charm.

maarts
New Contributor II

Thanks Bojan,

I started off with JSON and converted to XML, see attached pipeline. I think I will be missing something simple, but how do I do the remap you are suggesting?

Regards,

Martin