Hi all,
please consider this Big Moose FAQ page, how to validate XML:
https://coderanch.com/how-to/java/HowToValidateXmlAgainstAnySchema
Along this, the following code and a simple data sample deliver an error however.
Troubleshooting:
- XML+XSD checked online here, they seem to be okay then
http://www.freeformatter.com/xml-validator-xsd.html
- Local web server is working; if XSD url is changed, program reports connection error
- Local XML file is also there, changing its name causes a file not found error
Questions/Discussion:
- Q1 How to validate against schema, defining its location via code e.g. externally to the XML, so without changing the XML data (e.g. online tool might not load test.xsd locally to do the check)?
- Q2 How to validate passing schema as an xml schema string?
- Q3 Is it possible to validate an XML string without reading from disk?
Relevant error output (omitting warning about required custom error handler):
Java Code:
XML
XSD
Any help appreciated - cheers!
Noob