raaz
raaz

Reputation: 89

How to validate XML file using an XSD locally?

How can I validate XML file using an XSD locally on my PC?

Upvotes: 7

Views: 9914

Answers (5)

mlwacosmos
mlwacosmos

Reputation: 4561

Use notepad++ after you have downloaded XML Tools plugin.

Open your document, choose 'validate now' in plugin menu. Enter the path to the xsd et voilà.

Upvotes: 0

Ralph
Ralph

Reputation: 4868

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>

Upvotes: 2

Honest Abe
Honest Abe

Reputation: 79

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

Upvotes: 6

El Len
El Len

Reputation: 11

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.

Upvotes: 0

Michael Kay
Michael Kay

Reputation: 163352

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.

Upvotes: 0

Related Questions