SyntaxHighlighter JS

2013-03-13

xmllint: Format and Validate XML on Unix

xmllint can be used in Unix to format and validate XML.

  • How do I pretty format XML?
    xmllint --output newFile.xml --format oldFile.xml

  • How do I use tabs instead of spaces to format XML?
    XMLLINT_INDENT=$'\t' xmllint --output newFile.xml --format oldFile.xml

  • How do I validate an XML against a DTD?
    xmllint --dtdvalid http://java.sun.com/j2ee/dtds/web-app_2_2.dtd web.xml

  • How do I validate against a XSD schema?
    xmllint --debugent --schema http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd web.xml 

No comments:

Post a Comment