Pretty print curl raw requests from saved files

Viewed 67

I have a set of requests and responses saved in files as raw petitions. The files are like this:

--MIME_Boundary
Content-ID: <root.message@cxf.apache.org>
Content-Type: application/xop+xml; type="text/xml"; charset=utf-8
Content-Transfer-Encoding: 8bit

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><ns2:LoadFileResponse xmlns:ns2="http://ws.loadfile.com/loadfile/ws/LoadFileService" xmlns:ns3="http://ws.loadfile.com/loadfile/ws/CheckFileService"><ns2:responseFile><ns2:status>wait</ns2:status><ns2:fileId>2356</ns2:fileId></ns2:responseFile></ns2:LoadFileResponse></soap:Body></soapenv:Envelope>

--MIME_Boundary--

I want to show in a blade template with syntax highlight and code formatted. I used highlight.js to show the colors in the code, but I don´t know how to reformat the code.

enter image description here

I need something like codebeautify.org (https://codebeautify.org/xmlviewer/cbf69d49) but inside my own code.

I tried using DomDocument, but it´s not strictly XML and throws exceptions when using loadXML.

Is there any class or package to help me?

Thank you!

0 Answers
Related