You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2006/12/05 12:52:04 UTC

svn commit: r482609 - in /incubator/tuscany/cpp/sdo/runtime/core: src/commonj/sdo/SDOXMLWriter.cpp test/cdata-out.xml test/clone-out.xml test/main.cpp

Author: robbinspg
Date: Tue Dec  5 03:52:03 2006
New Revision: 482609

URL: http://svn.apache.org/viewvc?view=rev&rev=482609
Log:
TUSCANY-960 eliminate xsi:type="OpenDataObject" when serializing

Modified:
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
    incubator/tuscany/cpp/sdo/runtime/core/test/cdata-out.xml
    incubator/tuscany/cpp/sdo/runtime/core/test/clone-out.xml
    incubator/tuscany/cpp/sdo/runtime/core/test/main.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=482609&r1=482608&r2=482609
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp Tue Dec  5 03:52:03 2006
@@ -899,30 +899,35 @@
                         //        (const unsigned char*)value.c_str());
                         //}
                         //else
-                        //{
+						//{
                         if (cont->getTypeImpl().getPropertyImpl(elementName) == 0)
                         {
                             const SDOXMLString& typeURI = dataObject->getType().getURI(); 
                             const SDOXMLString& typeName = dataObject->getType().getName();
-                            
-                            SDOXMLString theName=typeName;
-            
-                            if (!typeURI.isNull() && !typeURI.equals(uri) && !typeURI.equals(""))
+
+                            // Supress the writing of xsi:type as well for DataObjects of type
+                            // commonj.sdo#OpenDataObject
+                            if (!(typeURI.equals("commonj.sdo") && typeName.equals("OpenDataObject")))
                             {
-                                std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(typeURI);
-                                if (it != namespaceMap.end())
+                                SDOXMLString theName=typeName;
+
+                                if (!typeURI.isNull() && !typeURI.equals(uri) && !typeURI.equals(""))
                                 {
-                                    theName = (*it).second;
-                                    theName += ":";
-                                    theName += typeName;
+                                    std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(typeURI);
+                                    if (it != namespaceMap.end())
+                                    {
+                                        theName = (*it).second;
+                                        theName += ":";
+                                        theName += typeName;
+                                    }
                                 }
-                            }
-                            
-                            rc = xmlTextWriterWriteAttribute(writer, 
-                            (const unsigned char*)"xsi:type", 
-                            (const unsigned char*)theName);
 
-                            writeXmlnsXsi();
+                                rc = xmlTextWriterWriteAttribute(writer, 
+                                    (const unsigned char*)"xsi:type", 
+                                    (const unsigned char*)theName);
+
+                                writeXmlnsXsi();
+                            }
                         }
                     }
                 }

Modified: incubator/tuscany/cpp/sdo/runtime/core/test/cdata-out.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/cdata-out.xml?view=diff&rev=482609&r1=482608&r2=482609
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/cdata-out.xml (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/cdata-out.xml Tue Dec  5 03:52:03 2006
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<test xmlns="http://www.example.org/test" xmlns:tns="http://www.example.org/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><entry1><data>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></data><fred>abcdefg</fred><fred><![CDATA[>>>>>>>>>]]></fred><fred>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></fred><jim xsi:type="OpenDataObject">xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></jim></entry1></test>
+<test xmlns="http://www.example.org/test" xmlns:tns="http://www.example.org/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><entry1><data>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></data><fred>abcdefg</fred><fred><![CDATA[>>>>>>>>>]]></fred><fred>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></fred><jim>xxx<![CDATA[<?xml version="1.0"encoding="UTF-8"?><MOREXML>....</MOREXML>]]>aaaa<![CDATA[>>>>>>>>>]]></jim></entry1></test>

Modified: incubator/tuscany/cpp/sdo/runtime/core/test/clone-out.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/clone-out.xml?view=diff&rev=482609&r1=482608&r2=482609
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/clone-out.xml (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/clone-out.xml Tue Dec  5 03:52:03 2006
@@ -1,10 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Clone xmlns="http://www.example.org/test" 
-           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-           xsi:schemaLocation="http://www.example.org/test clone.xsd ">
+<Clone xmlns="http://www.example.org/test" xmlns:tns="http://www.example.org/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   abc
   <test>test</test>
   def
   <tests>test</tests>
-  ghi
-</Clone>
+  ghi</Clone>

Modified: incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp?view=diff&rev=482609&r1=482608&r2=482609
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/main.cpp Tue Dec  5 03:52:03 2006
@@ -32,11 +32,11 @@
 
 #define TEST(testname)\
     value = testname;\
+    totaltests++;\
     if (value == 0) {\
         cout << "Test Failed: " << totaltests  << " " << #testname << endl;\
     }\
-    testspassed += value;\
-    totaltests++;
+    testspassed += value;
 
 int main (int argc, char** argv)
 {



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