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

multiple occurance of same attributes in Attributes

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.0
    • Fix Version/s: 2.6.0
    • Component/s: SAX/SAX2
    • Labels:
      None
    • Environment:
      Sun Solaris 8,Sun Workshop 6 Update 2

      Description

      If you have a schema like this :
      ...
      <xsd:element name="someElement">
      <xsd:complexType>
      <xsd:attribute name="someNumber" type="xsd:int" use="optional" default="0"/>
      </xsd:complexType>
      </xsd:element>
      ...

      and you have an instance of "someElement" like this:
      <someElement someNumber="3">
      ..
      </someElement>

      and then you want to process the attributes of an instance of
      "someElement" with code like this :

      void processAttributes(const Attributes& attrs)
      {
      const XMLCh* attrName;
      const XMLCh* attrValue;
      unsigned int noOfAttrs = attrs.getLength();
      unsigned int index;
      char* l_cptrAttrName = NULL;
      for ( index=0 ; index < noOfAttrs ; ++index )

      { attrName = attrs.getQName(index); attrValue = attrs.getValue(index); doSomeThing( attrName, attrValue ); }

      }

      There is an unexpected behaviour now in version 2.5.0:
      noOfAttr is 2 !! In the first loop the value of someNumber is 3.
      And in the second loop the value is 0 that may override the correct
      value 3.
      If you remove the default="0" phrase in the schema, then processing is correct as expected with noOfAttrs=1 and value=3.

      For me this is an error is new in version 2.5.0 and not in version 2.3.0.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ralf.kubiza@t-systems.com Ralf Kubiza
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: