Hi
All,
I having
a bit of bother with my first go at validating a schema in
xerces.
My input
document has no namespaces and I want to validate it against a schema. I'm
getting a "'http://mytestdomain.com/testurl
file://C:/Terminal201.xsd' is not a valid 'anyURI'
value" error when I try to set the noNamespaceSchemaLocation property
and I'm not sure how to get rid of it. My test code is
below.
DOMParser parser = new
DOMParser();
try
{
setProperty("http://xml.org/sax/features/validation",
true);
setProperty("http://apache.org/xml/features/validation/schema",
true);
parser.setProperty(
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
"http://mytestdomain.com/testurl
file://C:/Terminal201.xsd");
} catch
(SAXNotRecognizedException e) {
System.out.print("Unrecognized property:
");
} catch
(SAXNotSupportedException e) {
System.out.print("Unrecognized property:
");
}
try {
String sFile = "C:\\LMReturnTrxRequest.xml";
parser.parse(sFile);
}
catch (IOException ie) {
System.out.println("Could not read
file.");
}
catch (SAXException e) {
System.out.print("Could not create Document:
");
System.out.println(e.getMessage());
}
All help appreciated
Many
thanks,
Greg.