how to Validate a XML file with XSD through xmllint

XmlLinuxXsdXmllint

Xml Problem Overview


i have to validate my xml file with a given XSD file. Figured the easiest way to do so would be xmllint, but i can't get it to work. Can anyone tell me the exact command?

I tried:

     xmllint --valid myxsd.xsd myxml.xml

What am i doing wrong? This only outputs the 2 files in the command line

edit: have to do it in console, because it will be needed in a build process

Xml Solutions


Solution 1 - Xml

Figured it out, had to use --schema instead of --validate.

xmllint --schema yourxsd.xsd yourxml.xml --noout

The --noout makes sure your code in XSD and XML doesn't show. With this option you will only see the Validation Errors.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionEconView Question on Stackoverflow
Solution 1 - XmlEconView Answer on Stackoverflow