![]() So you get to decide the number of space stokes you want!įor example, I'll be adding the six space intends using fo to allow formatting: xml fo -s 6 email. It's nothing but adding at the top of the XML file. -t will intend the output with tabs for better visibility.This means it will add no space and the results will be similar to when you align text to the left. And it avails the xml command by which you can perform pretty much anything related to XML files!īut it requires manual installation and there's a snap package available to get you started: sudo snap install xmlstarletĪnd to format your XML files, you just have to pair format option with the xml command as shown below: xml format email.xmlĪnd as I mentioned earlier, it avails us various options and there are four formatting options: The XMLStarlet is a set of command line utilities serving different purposes. Get started on DigitalOcean with a $100, 60-day credit for new users. To reformat XML files using xmllint, you just have to follow the given syntax: xmllint -format XML_FILEĪnd for demonstration, I'll be using email.xml file: xmllint -format email.xmlĪnd the default intent is to add two spaces but what if you want to add more? you can use XMLLINT_INDENT environment variable.įor example, I'll be adding four spaces in my email.xml: XMLLINT_INDENT=" " xmllint -format email.xml The xmllint utility avails us the -format option by which users can re-format their XML files. The sample file email.xml contains two emails and I'm going to format this file to reduce the usual headache I get! So let's start with the first one: Method 1: Using xmllint to pretty print XML Sagar Arvind Heyy, send me the Goa pictures ASAP! Pretty print XML files in the terminalīefore going through the process, let me share unstructured XML which I'm going to use throughout the tutorial: Sagar Milan ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |