Validation of xs:keys and xs:keyrefs with xpath takes too long
--------------------------------------------------------------

                 Key: XERCESC-1878
                 URL: https://issues.apache.org/jira/browse/XERCESC-1878
             Project: Xerces-C++
          Issue Type: Bug
          Components: Validating Parser (XML Schema)
    Affects Versions: 3.0.1
         Environment: Scientific Linux 5.2, x86_64, GCC 4.4.0
            Reporter: Marc Sturm


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 (...)
{
   ///...
} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to