Forum Discussion

maarts's avatar
maarts
New Contributor II
2 years ago
Solved

How to change XML file to exclude root tag

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>

  • maarts's avatar
    maarts
    2 years ago

    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.

3 Replies

  • bojanvelevski's avatar
    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

    • maarts's avatar
      maarts
      New Contributor II

      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.