Since XMLSpy appears to have a bug or two, users of same could get
Xerces from http://xml.apache.org/ to verify the validity of XML schemas
and instance documents created with that editor. It's free, and doesn't
require any programming to use as a validator of existing documents. I
use the Java version with the following Windows script:
@echo OFF
setlocal
set XERCES_HOME=C:\xerces-2_6_0
set CLASSPATH=%XERCES_HOME%\xercesImpl.jar
set CLASSPATH=%CLASSPATH%;%XERCES_HOME%\xml-apis.jar
set CLASSPATH=%CLASSPATH%;%XERCES_HOME%\xercesSamples.jar
java -cp "%CLASSPATH%" dom.Counter -v -s -f %*
endlocal
Assuming the script is named xsdvalidator.bat, it's used like
xsdvalidator instance.xml
The dom.Counter sample application just prints the number of elements
and attributes in the instance document, but with the -v -s -f options
it validates the instance document (by DTD if there's an DOCTYPE
declaration, and by schema if there's an xsi:schemaLocation attribute
present). It additionally validates every schema according to the
built-in schema for schemas.
--Andy
|