Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1878

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.1
    • 3.1.0
    • 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 (...)
      {
      ///...
      }

      Attachments

        Activity

          People

            amassari Alberto Massari
            marc_sturm Marc Sturm
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: