I am having a problem with some XML print files where the source system omits to convert some characters to their XML syntax equivalent (e.g. & is not converted to &
).
Is there a way to catch this with xmllint? (I don't need to check the general tree structure using XSD).
By default xmllint "checks to determine if the document is well-formed". So, xmllint --noout --nonet goodfoo. xml will be comletely silent with an exit code of 0 for well-formed XML while xmllint --noout --nonet badfoo.
XML documents are validated by the Create method of the XmlReader class. To validate an XML document, construct an XmlReaderSettings object that contains an XML schema definition language (XSD) schema with which to validate the XML document.
After opening the XML file, go to the Plugins menu and you will now see the XML Tools option added to it. Simply go to the XML Tools > Validate Now option and click on it. You can also press Ctrl + Alt + Shift + M key combination to open Validate Now option.
xmllint --noout your_test_file.xml
Check for return code of this command. See documentation. Value of 1
is returned when basic parsing errors are met. E.g.:
echo $?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With