You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Pete Robbins <ro...@googlemail.com> on 2006/09/27 18:50:31 UTC
[C++] [SDO] Re: svn commit: r449323 - writing xsi:type
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, jsdelfino@apache.org <js...@apache.org> 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: tuscany-commits-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-commits-help@ws.apache.org
>
>
--
Pete
Re: [C++] [SDO] Re: svn commit: r449323 - writing xsi:type
Posted by Jean-Sebastien Delfino <js...@apache.org>.
Pete Robbins wrote:
[snip]
> 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,
>
Looks good to me. I just needed to add one more test on top of your
changes to turn the writing of xsi:type off for DataObjects of type
commonj.sdo#OpenDataObject, that was all.
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org