Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.1
-
None
-
Scientific Linux 5.2, x86_64, GCC 4.4.0
Description
When an mzML XML file against its schema, the validation of the xs:keys and xs:keyrefs using xpath takes 40 to 60 minutes. Validation without keys only takes about 30 seconds.
The following files can be used to reproduce the problem:
http://www-bs2.informatik.uni-tuebingen.de/services/sturm/public/example.mzML (XML instance document)
http://www-bs2.informatik.uni-tuebingen.de/services/sturm/public/mzML110.xsd (slow validation schema)
http://www-bs2.informatik.uni-tuebingen.de/services/sturm/public/mzML110_without_constraints.xsd (fast validation schema)
I confirmed the behavior in version 3.0.0, 3.0.1 and Trunk revision 794181.
This is the C++ code used for the validation is:
//initialize
try
{
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch)
{
//...
}
SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
parser->setFeature(XMLUni::fgXercesDynamic, false);
parser->setFeature(XMLUni::fgXercesSchema, true);
parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
//set this class as error handler
parser->setErrorHandler(this);
parser->setContentHandler(NULL);
parser->setEntityResolver(NULL);
//load schema
LocalFileInputSource schema_file(schema);
parser->loadGrammar(schema_file, Grammar::SchemaGrammarType, true);
parser->setFeature(XMLUni::fgXercesUseCachedGrammarInParse, true);
// try to validate the file
LocalFileInputSource source(filename);
try
{
parser->parse(source);
delete(parser);
}
catch (...)
{
///...
}