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

Parse fails for node with similar attribute names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.4.0
    • 2.5.0
    • Non-Validating Parser
    • None
    • Operating System: Linux
      Platform: All
    • 27947

    Description

      I have a document which contains a node similar to this one:

      <foo dtEnd="bar" dtStart="baz" />

      The document has no DTD, so I guess the non-validating parser is in use. The
      parser chokes, giving me an error "The attribute 'dtStart' is already used in
      element 'foo'." If I change "dtEnd" to "dtEne", say, parsing works. I've
      verified that the error can be demonstrated with the StdInParse sample app
      inputting just this node.

      It appears that dtEnd and dtStart have the same hash when placed into the
      fUndeclaredAttrRegistry in (??)XMLScanner.cpp and the resulting collision gives
      my error.

      I notice that, in version 2.4.0, fUndeclaredAttrRegistry was declared as a
      RefHashTableOf<unsigned int> with a hash modulo 509. It looks as if the
      attribute name is hashed and used as a key into the map, with only one entry
      permitted per bucket, hence the collision with dissimilar names. I'm confused
      therefore that the modulo was reduced, first to 131 (IGXMLScanner.cpp v1.45),
      then to 7 (v1.55) and seek enlightenment!

      Note that the same document will parse successfully on Windows (using the XML4C
      v5.2 code branch.)

      Attachments

        Activity

          People

            Unassigned Unassigned
            robert.howard@rbccm.com Rob Howard
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: