You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by na...@apache.org on 2010/03/15 23:49:11 UTC

svn commit: r923488 - /axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp

Author: nadiramra
Date: Mon Mar 15 22:49:10 2010
New Revision: 923488

URL: http://svn.apache.org/viewvc?rev=923488&view=rev
Log:
AXISCPP-1066 - anyType element causes parser to be out of sync

Modified:
    axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp

Modified: axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp?rev=923488&r1=923487&r2=923488&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp (original)
+++ axis/axis1/c/trunk/src/soap/SoapDeSerializer.cpp Mon Mar 15 22:49:10 2010
@@ -2211,12 +2211,21 @@ getAnyObject ()
             else
                 bContinue = false;
             
-            // Increment counter if entering new tag, Decrement counter if exiting tag
-            if (START_ELEMENT == m_pNode->m_type && START_END_ELEMENT != m_pNode->m_type2)
-                tagCount++;
-            else if (END_ELEMENT == m_pNode->m_type)
-                tagCount--;
-    
+            // if empty element we need to do a parser get to consume the end-element node.
+            if (START_END_ELEMENT == m_pNode->m_type2)
+            {
+                if (END_ELEMENT == m_pNode->m_type)
+                    m_pNode = m_pParser->anyNext ();
+            }
+            else
+            {
+                // Increment counter if entering new tag, Decrement counter if exiting tag
+                if (START_ELEMENT == m_pNode->m_type)
+                    tagCount++;
+                else if (END_ELEMENT == m_pNode->m_type)
+                    tagCount--;
+            }
+
             if (START_PREFIX == m_pNode->m_type)
             {
                 nsDecls += " xmlns";
@@ -2242,10 +2251,16 @@ getAnyObject ()
                 xmlStr += outValue;
             }
         
-            if ( !bContinue && tagCount == 0 && (!xmlStr.empty ()))    /* copying the First level element into the list */
+            /* copy the First level element into the list */
+            if ( !bContinue && tagCount == 0 && (!xmlStr.empty ()))
             {
                 lstXML.push_back (xmlStr);
                 xmlStr = "";
+
+                // If the anyType element is empty element, we need to consume END_ELEMENT.
+                if (START_END_ELEMENT == m_pNode->m_type2 && START_ELEMENT == m_pNode->m_type)
+                    m_pNode = m_pParser->anyNext ();
+
                 m_pNode = NULL;
                 break;
             }