You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by na...@apache.org on 2007/03/09 07:06:30 UTC

svn commit: r516310 - /webservices/axis/trunk/c/src/common/Param.cpp

Author: nadiramra
Date: Thu Mar  8 22:06:29 2007
New Revision: 516310

URL: http://svn.apache.org/viewvc?view=rev&rev=516310
Log:
AXISCPP-1026 - Should set nil attribute if NULL array.  
Eliminate generation of null string namespace.

Modified:
    webservices/axis/trunk/c/src/common/Param.cpp

Modified: webservices/axis/trunk/c/src/common/Param.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/common/Param.cpp?view=diff&rev=516310&r1=516309&r2=516310
==============================================================================
--- webservices/axis/trunk/c/src/common/Param.cpp (original)
+++ webservices/axis/trunk/c/src/common/Param.cpp Thu Mar  8 22:06:29 2007
@@ -91,34 +91,48 @@
                 // get a prefix from Serializer
                 ATprefix = pSZ.getNamespacePrefix (m_Value.pArray->m_URI.c_str ());
 
-                pSZ.serialize (" xmlns:enc", NULL);
-                pSZ.serialize ("=\"http://www.w3.org/2001/06/soap-encoding\" ", NULL);
-                
-                if (m_Value.pArray->m_type == USER_TYPE)
+                if (m_Value.pArray->m_value.cta==NULL || 
+                  m_Value.pArray->m_value.cta->pObject==NULL)
                 {
-                    pSZ.serialize ("xmlns:", ATprefix.c_str (), "=\"",
-                        m_Value.pArray->m_URI.c_str (), "\" ", NULL);
-                }
-                pSZ.serialize ("enc:arrayType=\"", NULL);
-                if (m_Value.pArray->m_type == USER_TYPE)
-                {
-                    pSZ.serialize (ATprefix.c_str (), ":",
-                        m_Value.pArray->m_TypeName.c_str (), NULL);
-                }
-                else //basic type array
-                {
-                    pSZ.serialize ("xsd:", BasicTypeSerializer::
-                        basicTypeStr (m_Value.pArray->m_type), NULL);
+                  // ======================================================================
+                  // If null input, serialize as nil element.
+                  // ======================================================================
+
+	                pSZ.serializeAsAttribute( "xsi:nil", 0, (void*)&(xsd_boolean_true), XSD_BOOLEAN);
+	                pSZ.serialize( ">", NULL);
                 }
-                
+                else
                 {
-                    char Buf[10]; //maximum array dimension is 99999999
-                    sprintf (Buf, "[%d]", m_Value.pArray->m_nSize);
-                    pSZ.serialize (Buf, NULL);
-                }
+                  pSZ.serialize (" xmlns:enc", NULL);
+                  pSZ.serialize ("=\"http://www.w3.org/2001/06/soap-encoding\" ", NULL);
+                  
+                  if (m_Value.pArray->m_type == USER_TYPE &&
+                    !m_Value.pArray->m_URI.empty())
+                  {
+                      pSZ.serialize ("xmlns:", ATprefix.c_str (), "=\"",
+                          m_Value.pArray->m_URI.c_str (), "\" ", NULL);
+                  }
+                  pSZ.serialize ("enc:arrayType=\"", NULL);
+                  if (m_Value.pArray->m_type == USER_TYPE)
+                  {
+                      pSZ.serialize (ATprefix.c_str (), ":",
+                          m_Value.pArray->m_TypeName.c_str (), NULL);
+                  }
+                  else //basic type array
+                  {
+                      pSZ.serialize ("xsd:", BasicTypeSerializer::
+                          basicTypeStr (m_Value.pArray->m_type), NULL);
+                  }
+                  
+                  {
+                      char Buf[10]; //maximum array dimension is 99999999
+                      sprintf (Buf, "[%d]", m_Value.pArray->m_nSize);
+                      pSZ.serialize (Buf, NULL);
+                  }
 
-                pSZ.serialize ("\">\n", NULL);
-                m_Value.pArray->Serialize (pSZ); //Only serializes the inner items
+                  pSZ.serialize ("\">\n", NULL);
+                  m_Value.pArray->Serialize (pSZ); //Only serializes the inner items
+                }
                 pSZ.serialize ("</", NULL);
                 if (!m_strPrefix.empty ())
                     pSZ.serialize (m_strPrefix.c_str (), ":", m_sName.c_str (), NULL);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org