How to print XML? what kind of blog is this? is there a use of printer nowadays? hmm…
So the right question would be where do you print the XML? on browser console? on PDF ? on Papar (really!!)? or just want to format the XML data.
Let’s start with printing xml on browser console.
Print XML on Browser’s Console
<!DOCTYPE html> <html> <body> <script src="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/vkbeautify/vkbeautify.0.99.00.beta.js"></script> <script> var parser, xmlDoc; var text = "<employees><employee><id>1</id><firstName>Leonardo</firstName><lastName>DiCaprio</lastName></employee></employees>"; console.log(vkbeautify.xml(text)); </script> </body> </html>
Copy the HTML code and create .html file, open in browser and open console to see the beautiful XML will be in Browser console log.
Print XML on PDF or Paper
Here is a way to create XML PDF. I don’t want to go into complex coding do to this. I have developed a tool which will help to do the same.
Follow this steps.
Go to XML Pretty Print tool.
Click on XML Print button, which will open a print view of XML. Now you have the option to Print or Save as PDF.
This article helps to Print beautiful XML on Brower Console, PDF and on Paper.
Advance topic XML from URL and File.
Now we are going for more advance into this topic what if you have URL or File which you want to beautify and print?
Here are the steps for the XML from URL.
XML from URL
Go to XML Pretty Print tool. Click on “Load Data” button, which will open a dialogue box to enter a URL string into Text.
Paste your XML URL into the textbox and hit Load URL. It will fetch the data from the URL and update the Input XML text area. Click on XML Print to Write XML to PDF or Paper.
XML from File
Go to XML Pretty Print tool. Click on “Load Data” button, which will open a dialogue box.
Click Upload File button which will open a file selector. Select XML file and Hit Open.
XML file will be uploaded and loaded in the Input XML area.
Click XML Print to Print XML to PDF or Paper.