You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by ax...@ws.apache.org on 2004/08/16 13:12:19 UTC

[jira] Closed: (AXISCPP-49) Xerces mutilple attibutes and Empty element

Message:

   The following issue has been closed.

   Resolver: Samisa Abeysinghe
       Date: Mon, 16 Aug 2004 4:12 AM

This problem was resolved by Susantha.
---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXISCPP-49

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXISCPP-49
    Summary: Xerces mutilple attibutes and Empty element
       Type: Bug

     Status: Closed
   Priority: Blocker
 Resolution: FIXED

    Project: Axis-C++
 Components: 
             Serialization/Deserialization
   Fix Fors:
             1.1 Final
   Versions:
             1.1 Final

   Assignee: 
   Reporter: Jean-Yves Baudy

    Created: Fri, 9 Apr 2004 7:09 AM
    Updated: Mon, 16 Aug 2004 4:12 AM
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;
 




---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira