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

WFXMLScanner fails for two attributes with same local name but different namespaces

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.4.0
    • 2.5.0
    • Non-Validating Parser
    • None
    • Operating System: Other
      Platform: Other
    • 26131

    Description

      If you parse this document

      <?xml version="1.0" encoding="iso-8859-1"?>
      <x xmlns:a="a" xmlns:b="b">
      <y a:driss="aaa" b:driss="aaa"/>
      </x>

      with WFXMLScanner, it reports the double defined attribute "driss".

      This is because within WFXMLScanner.cpp
      ...
      XMLAttr* loopAttr;
      for (unsigned int attrIndex=0; attrIndex < attCount; attrIndex++) {
      loopAttr = fAttrList->elementAt(attrIndex);
      if (curAtt->getURIId() == loopAttr->getURIId() &&
      XMLString::equals(curAtt->getName(), loopAttr->getName()))

      { emitError ( XMLErrs::AttrAlreadyUsedInSTag , curAtt->getName() , elemDecl->getFullName() ); }

      }
      ...
      all "curAtt->getURIId()" and "loopAttr->curAtt->getURIId()" are the same for all
      prefixed or non prefixed attributes. In my opinion there is missing (the same
      file, but somewhere above)
      ...
      if (attPrefix && *attPrefix) {
      if (XMLString::equals(attPrefix, XMLUni::fgXMLString))

      { curAtt->setURIId(fXMLNamespaceId); }

      ...
      else

      { *** curAtt->setURIId(fElemStack.getPrefixId(attPrefix)); *** fAttrNSList->addElement(curAtt); }

      ...

      the "***" marked line. But I am not sure, whether namespace attributes within an
      element are processed first, and the namespace will be found on the
      element-stack prefixes.

      Attachments

        Activity

          People

            Unassigned Unassigned
            floerke@doctronic.de Holger Floerke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: