Issue Details (XML | Word | Printable)

Key: AXISCPP-403
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adrian Dick
Reporter: Adrian Dick
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Axis-C++

Namespace prefix omitted when object is nil

Created: 02/Feb/05 01:55 AM   Updated: 05/Mar/05 12:39 AM
Return to search
Component/s: Serialization
Affects Version/s: current (nightly)
Fix Version/s: current (nightly)

Time Tracking:
Not Specified

Resolution Date: 02/Feb/05 02:10 AM


 Description  « Hide
When a simple type is serialized as an element, and is nil, the namespace prefix is omitted from the opening XML tag.

Using an extract from the ComplexTypeAll test, which highlighted this issue:
The text element field1 should be represented as:
  <ns1:field1 xsi:nil="true"></ns1:field1>
But is actually being represented as:
  <field1 xsi:nil="true"></ns1:field1>



Currently, in BasicTypeSerializer::serializeAsElement()for XSD_STRING, XSD_ANYURI, XSD_QNAME and XSD_NOTATION there is a check for a NULL value, into this the lines marked + in the following need to be inserted:
 pStr = *((char**)(pValue));
 if (!pStr)
 {
   /*
    * It is a null value not an empty value.
    */
   m_sSZ = "<";
+ if (NULL != pPrefix)
+ {
+ m_sSZ += pPrefix;
+ m_sSZ += ":";
+ }
   m_sSZ += pName;
   m_sSZ += " xsi:nil=\"true\">";
 }


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Adrian Dick added a comment - 02/Feb/05 02:10 AM
Made modifications as described in original submission.
Have also introduced a new test NilValuesTest to detect any future regressions in this area.