Axis-C++
  1. Axis-C++
  2. AXISCPP-49

Xerces mutilple attibutes and Empty element

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.1 Final
    • Fix Version/s: 1.1 Final
    • Component/s: Serialization
    • Labels:
      None
    • Environment:
      All

      Description

      Current CVS state don't handle well the following case with Xerces:

      <tag/>
      or
      <tag></tag>

      <tag1>Test</tag1>

      With the last CVS contains, by adding Next(Boolean) API to parser, the deserialization process not end with segfault as before. But value returned just after an empty element is wrong. For more information see : http://marc.theaimsgroup.com/?t=108137002000002&r=1&w=2

      Also when an element has more than on attribute only the first is returned (see patch)

      — c/src/soap/SoapParserXerces.cpp Fri Apr 9 14:44:08 2004
      +++ src/soap/SoapParserXerces.cpp Fri Apr 9 15:48:24 2004
      @@ -58,6 +58,7 @@
      m_pParser->parseReset(token);
      firstParsed = false;
      }
      + Xhandler.ResetEmptyElement();
      return 0;
      }

      @@ -81,6 +82,12 @@
      firstParsed = true;
      }

      + if ( Xhandler.GetEmptyElement() )
      +

      { + Xhandler.ResetEmptyElement(); + return Xhandler.getAnyElement(); + }

      +
      Xhandler.freeElement();
      while (true)
      {
      — c/src/soap/XercesHandler.cpp Thu Apr 8 15:21:50 2004
      +++ src/soap/XercesHandler.cpp Fri Apr 9 15:48:39 2004
      @@ -47,16 +47,21 @@

      unsigned int len = attrs.getLength();
      unsigned int index;
      + unsigned int xercesIndex;
      + xercesIndex = 0;
      +
      for (index = 0; index < len*3; index+=3)

      { Nelement->m_pchAttributes[index] = - XMLString::transcode(attrs.getLocalName(index)); + XMLString::transcode(attrs.getLocalName(xercesIndex)); Nelement->m_pchAttributes[index+1] = - XMLString::transcode(attrs.getURI(index)); + XMLString::transcode(attrs.getURI(xercesIndex)); Nelement->m_pchAttributes[index+2] = - XMLString::transcode(attrs.getValue(index)); + XMLString::transcode(attrs.getValue(xercesIndex)); + xercesIndex++; }

      Nelement->m_pchAttributes[len*3]=NULL;
      + m_nEmptyElement = 0;
      }

      const XML_Ch* XercesHandler::NS4Prefix(const XML_Ch* prefix)
      @@ -74,6 +79,7 @@
      m_pCurrElement = Nelement;
      Nelement->m_type = CHARACTER_ELEMENT;
      Nelement->m_pchNameOrValue = XMLString::transcode(chars);
      + m_nEmptyElement = 0;
      }
      void XercesHandler::ignorableWhitespace(const XMLCh* const chars,
      const unsigned int length)
      @@ -97,6 +103,10 @@
      const XMLCh *const localname,
      const XMLCh *const qname)
      {
      + if ( m_pCurrElement == Nelement )
      + m_nEmptyElement = 1;
      + else
      + m_nEmptyElement = 0;
      m_pCurrElement = Nelement;
      Nelement->m_type = END_ELEMENT;
      Nelement->m_pchNameOrValue = XMLString::transcode(localname);
      — c/src/soap/XercesHandler.h Thu Apr 8 15:21:50 2004
      +++ src/soap/XercesHandler.h Fri Apr 9 15:48:06 2004
      @@ -35,6 +35,8 @@
      public :
      void freeElement();
      int GetStatus()

      {return m_nStatus;}

      ;
      + int GetEmptyElement()

      {return m_nEmptyElement;}

      ;
      + void ResetEmptyElement()

      { m_nEmptyElement=0;}

      ;
      /* -----------------------------------------------------------------------

      • Constructors
      • -----------------------------------------------------------------------
        @@ -77,6 +79,7 @@
        void fatalError(const SAXParseException& exception);

      int m_nStatus;
      + int m_nEmptyElement;
      AnyElement * Nelement;
      AnyElement * m_pCurrElement;

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Jean-Yves Baudy
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development