You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Felix Planjer <Fe...@YellowRed.nl> on 2002/09/03 19:19:15 UTC
Random schema validation errors using multiple threads
Hi,
We're using xerces 2.1.0 in a multi-threaded application.
Bascally we get a lot of xml files from a certain location, validate them
against a schema, transform them using xslt and then process those files.
When running with multiple threads however, the validation sometimes fails
with the following exception:
org.xml.sax.SAXParseException: cvc-attribute.3: The value
'2002-08-27T12:00:00' of attribute 'date' on element 'National' is not valid
with respect to its type.
The attribute the exception mentions is of type xsd:dateTime and the files
are correct.
This exception is thrown on different files every run, but always mentioning
attributes of the xsd:dateType type.
If we re-run the application with the same files other files throw the error
and files that previously threw the exception, work fine.
This is part of our code:
====================================================
DOMParser domparser = new DOMParser();
domparser.setErrorHandler(this);
try {
synchronized (domparser) {
domparser.setFeature("http://xml.org/sax/features/validation",
true);
}
synchronized (domparser) {
domparser.setFeature("http://apache.org/xml/features/validation/schema",
true);
}
} catch (SAXNotRecognizedException e) {
logErrorMessage(e.toString());
} catch (SAXNotSupportedException e) {
logErrorMessage(e.toString());
}
try {
String myString = "";
synchronized (domparser) {
domparser.setProperty("http://apache.org/xml/properties/schema/external-noNa
mespaceSchemaLocation", schemafilename);
}
} catch (SAXException ex) {
rollBack();
logErrorMessage(ex.toString());
return;
}
try {
synchronized (domparser) {
domparser.parse(inputsource);
}
if (isValidFile) {
<continue processing>
} else {
<log error and quit>
}
}
===================================================================
(The class I copied this from implements ErrorHandler interface, and the
error and fatalerror methods set the isValidFile variable to false.
What can be the problem here?
Felix Planjer