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

Order sensitivity in schemaLocation and noNamespaceSchemaLocation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.0
    • 3.1.0
    • None
    • all

    Description

      I am attaching two test cases (each consists of 3 schemas plus an XML instance). If you try to run domprint on the first test case, you will get the following error:

      $ domprint -v=always -n -s -f test-users.xml

      Error at file "test-users.xml", line 6, column 78
      Message: Unknown element 'b:UserDatabase'

      If you change the order of the schemaLocation and noNamespaceSchemaLocation attributes in test-users.xml then the error disappears.

      The second test case is a slight modification of the first test case with the only difference being the schemas with targetNamespace are now do not have a namespace, and the schema that used to be without a namespace (derived-user-config.xsd) now is in a namespace. If you run domprint on this test case, you will get the following error:

      $ domprint -v=always -n -s -f test-users.xml
      Error at file "test-users.xml", line 6, column 55
      Message: Unknown element 'UserDatabase'

      This seems to prove that for Xerces-C++, for some reason, it is important that the schema that declares the root element is mentioned in the first *Location attribute (nor matter whether schemaLocation or noNamespaceSchemaLocation). Now comes the surprise: if we reverse the order of the two attributes in the second test case, domprint terminates with segmentation fault. Examination of the core points to the IGXMLScanner.cpp, line 2288:

      elemDecl = fGrammar->getElemDecl(
      uriId, nameRawBuf, qnameRawBuf, currentScope
      );

      Attachments

        1. test-case-2.tar.gz
          1.0 kB
          Boris Kolpackov
        2. test-case-1.tar.gz
          1.0 kB
          Boris Kolpackov

        Activity

          People

            bsk Boris Kolpackov
            bsk Boris Kolpackov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: