XML Validation
Jump to navigation
Jump to search
The xmllint tool can be used to validate XML documents against DTDs and XML Schema definitions. It can be downloaded as a part of the free, open-source libxml2 package at http://xmlsoft.org/xmldtd.html.
These are some examples of using the xmllint command.
To validate XML data with a DTD stored in the same file:
xmllint --valid --noout DataFileWithDTD.xml
To validate XML data against a separately stored DTD:
xmllint --dtdvalid DTD.dtd --noout DataFileWithoutDTD.xml
To validate XML data against a separately stored XML Schema definition:
xmllint --schema XMLSchemaFile.xsd --noout DataFile.xml
Alternatively, the following online services can also be used to validate XML:
- W3C Markup Validation Service for DTDs
- XML for ASP.NET Schema Validator for XML Schema.