How can I validate XML file using an XSD locally on my PC?
4 Answers
I have written a number of xsd to validate an xml -- most solution came from this site. I've focused more on using xmllint!
xmllint -schema <your xsd file> <your xml file>
HTH

- 29
- 2
You simply have to put the xsi:noNamespaceSchemaLocation attribute into your root tag pointing to your local xsd file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2020.2"
xsi:noNamespaceSchemaLocation="your-schema.xsd">
<....>
....
</data>

- 4,500
- 9
- 48
- 87
For validating XML files against a XSD you have several options. Here are two of these which I find useful.
One option is to use Apache Xerces Parser. Xerces is available for Java as well as for C++.
Another option I often use is the XML plug-in in Notepad++. You can validate your xml against a chosen XSD very easy. Here is a very well description.

- 11
- 2
If it's an occasional requirement to validate individual files in an ad-hoc way, consider getting an IDE such as oXygen or Stylus Studio - unless you're comfortable using tools from the command line.
If it's a regular process that you want to automate, then I think we need to know more about the requirements.

- 156,231
- 11
- 92
- 164