The logic for when to write xsi:type was incorrect. I have now fixed this and re-gen'd the sdo test output files.
Cheers, On 23/09/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: jsdelfino Date: Sat Sep 23 15:51:30 2006 New Revision: 449323 URL: http://svn.apache.org/viewvc?view=rev&rev=449323 Log: Fixed writing of xsi:type, do not write it when writing a root document and the root element name is known, do not write it twice on children of open types. Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp?view=diff&rev=449323&r1=449322&r2=449323 ============================================================================== --- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp (original) +++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp Sat Sep 23 15:51:30 2006 @@ -129,7 +129,7 @@ writeXSIType = true; } - writeDO(root, elementURI, elementName, true, true); + writeDO(root, elementURI, elementName, writeXSIType, true); } rc = xmlTextWriterEndDocument(writer); if (rc < 0) { @@ -787,30 +787,33 @@ // write out the type if the xsi:type if the containing type is open // and the property is not one of the declared properties ////////////////////////////////////////////////////////////////////////// - DataObject* dob = dataObject; - DataObjectImpl* cont = - ((DataObjectImpl*)dob)->getContainerImpl(); - if (cont != 0) + if (!writeXSIType) { - if (cont->getType().isOpenType()) - { - //if (dataObject->getType().getURI() != 0) - //{ - // std::string value = - // dataObject->getType().getURI(); - // value += ":"; - // value += dataObject->getType().getName(); - // rc = xmlTextWriterWriteAttribute(writer, - // (const unsigned char*)"xsi:type", - // (const unsigned char*)value.c_str()); - //} - //else - //{ - if (cont->getTypeImpl().getPropertyImpl(elementName) == 0) - { - rc = xmlTextWriterWriteAttribute(writer, - (const unsigned char*)"xsi:type", - (const unsigned char*)dataObject->getType().getName()); + DataObject* dob = dataObject; + DataObjectImpl* cont = + ((DataObjectImpl*)dob)->getContainerImpl(); + if (cont != 0) + { + if (cont->getType().isOpenType()) + { + //if (dataObject->getType().getURI() != 0) + //{ + // std::string value = + // dataObject->getType().getURI(); + // value += ":"; + // value += dataObject->getType().getName(); + // rc = xmlTextWriterWriteAttribute(writer, + // (const unsigned char*)"xsi:type", + // (const unsigned char*)value.c_str()); + //} + //else + //{ + if (cont->getTypeImpl().getPropertyImpl(elementName) == 0) + { + rc = xmlTextWriterWriteAttribute(writer, + (const unsigned char*)"xsi:type", + (const unsigned char*)dataObject->getType().getName()); + } } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Pete
