Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1754

XMLSchemaValidator reset no longer resets id validation caches

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      I validate an XML with an XML Schema 1.1 file.
      On the first validation the XML is reported valid.
      On the second validation I re-use the parser, the ID values inside elements are reported as duplicate and I get errors like this reported:

      Message: cvc-type.3.1.3: The value 'thing122' of element 'uid' is not valid.

      Looking at the method org.apache.xerces.impl.xs.XMLSchemaValidator.reset(XMLComponentManager), there is a fast return inside it:

              if (!parser_settings) {
                  // parser settings have not been changed
                  fValidationManager.addValidationState(fValidationState);
                  // the node limit on the SecurityManager may have changed so need to refresh.
                  nodeFactory.reset();
                  // Re-parse external schema location properties.
                  XMLSchemaLoader.processExternalHints(
                      fExternalSchemas,
                      fExternalNoNamespaceSchema,
                      fLocationPairs,
                      fXSIErrorReporter.fErrorReporter);
                  return;
              }

      and this means all the code which for example cleared the IDs cache:

              // reset ID Context
              if (fIDContext != null) {
                  fIDContext.clear();
              }

      is no longer executed.

      Attachments

        1. test.xsd
          0.7 kB
          Radu Coravu
        2. test.xml
          0.3 kB
          Radu Coravu

        Activity

          People

            mukul_gandhi Mukul Gandhi
            radu_coravu Radu Coravu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: