tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robbin...@apache.org
Subject svn commit: r553836 - in /incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core: src/commonj/sdo/ test/
Date Fri, 06 Jul 2007 11:14:23 GMT
Author: robbinspg
Date: Fri Jul  6 04:14:22 2007
New Revision: 553836

URL: http://svn.apache.org/viewvc?view=rev&rev=553836
Log:
TUSCANY-1112 correct handling of element form

Modified:
    incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
    incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
    incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SchemaInfo.cpp
    incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SchemaInfo.h
    incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/jira1112expected.xml
    incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/loadload-output.txt
    incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/types.xsd

Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp?view=diff&rev=553836&r1=553835&r2=553836
==============================================================================
--- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
(original)
+++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
Fri Jul  6 04:14:22 2007
@@ -230,6 +230,14 @@
                         if (attributes[i].getName().equalsIgnoreCase("targetNamespace"))
                         {
                             schemaInfo.setTargetNamespaceURI(attributes[i].getValue());
+                        }
+
+                        if (attributes[i].getName().equalsIgnoreCase("elementFormDefault"))
+                        {
+                            if (attributes[i].getValue().equals("qualified"))
+                            {
+                                schemaInfo.setElementFormDefaultQualified(true);
+                            }
                         }                        
                     }
 
@@ -745,7 +753,23 @@
                 thisProperty.name,
                 thisProperty.localname);
 
-            thisProperty.namespaceURI = schemaInfo.getTargetNamespaceURI();
+            // Set the property's namespace if elementForm is "qualified"
+            bool elementFormQualified = schemaInfo.isElementFormDefaultQualified();
+            SDOXMLString elementForm = attributes.getValue("form");
+            if (!elementForm.isNull())
+            {
+                elementFormQualified = false;
+                if (elementForm.equals("qualified"))
+                {
+                    elementFormQualified = true;
+                }
+            }
+
+            if (elementFormQualified
+                || currentType.name.equals("RootType"))
+            {
+                thisProperty.namespaceURI = schemaInfo.getTargetNamespaceURI();
+            }
             
             setType(thisProperty, attributes, namespaces);
 

Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp?view=diff&rev=553836&r1=553835&r2=553836
==============================================================================
--- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
(original)
+++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SDOXMLWriter.cpp
Fri Jul  6 04:14:22 2007
@@ -739,10 +739,12 @@
                 // Write the startElement for non-root object
                 SDOXMLString theName=elementName;
 
+                // If an elementURI is specified then the elementForm is "qualified"
                 if (!elementURI.isNull() 
                     && !elementURI.equals("")
                     && !elementURI.equals(s_commonjsdo)
-                    && !elementURI.equals(tnsURI))
+                    //&& !elementURI.equals(tnsURI)
+                    )
                 {
                     // Locate the namespace prefix
                     std::map<SDOXMLString,SDOXMLString>::iterator it = namespaceMap.find(elementURI);
@@ -1388,8 +1390,8 @@
               else
               {
                   // The property has been defined programatically so we will
-                  // assume it is the namespace fo the parent DataObject
-                  elementURI = typeImpl.getURI();
+                  // assume elementForm is "unqualified"
+                  elementURI = ""; 
               }
 
           }

Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SchemaInfo.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SchemaInfo.cpp?view=diff&rev=553836&r1=553835&r2=553836
==============================================================================
--- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SchemaInfo.cpp
(original)
+++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SchemaInfo.cpp
Fri Jul  6 04:14:22 2007
@@ -26,7 +26,8 @@
     {
 
         SchemaInfo::SchemaInfo()
-            : targetNamespaceURI("")
+            : targetNamespaceURI(""),
+              elementFormDefaultQualified(false)
         {
         }
         

Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SchemaInfo.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SchemaInfo.h?view=diff&rev=553836&r1=553835&r2=553836
==============================================================================
--- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SchemaInfo.h (original)
+++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/src/commonj/sdo/SchemaInfo.h Fri
Jul  6 04:14:22 2007
@@ -49,9 +49,12 @@
             SDO_SPI const SDOXMLString& getTargetNamespaceURI() const {return targetNamespaceURI;}
             SDO_SPI void setTargetNamespaceURI(const SDOXMLString& URI) {targetNamespaceURI
= URI;}            
             
+            SDO_SPI bool isElementFormDefaultQualified() {return elementFormDefaultQualified;}
           
+            SDO_SPI void setElementFormDefaultQualified(bool qualified) {elementFormDefaultQualified
= qualified;}            
         private:
             SAX2Namespaces    schemaNamespaces;
-            SDOXMLString    targetNamespaceURI;            
+            SDOXMLString    targetNamespaceURI;           
+            bool elementFormDefaultQualified;
             
         };
     } // End - namespace sdo

Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/jira1112expected.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/jira1112expected.xml?view=diff&rev=553836&r1=553835&r2=553836
==============================================================================
--- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/jira1112expected.xml (original)
+++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/jira1112expected.xml Fri Jul
 6 04:14:22 2007
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <BOGUS xmlns="http://Component" xsi:type="add" xmlns:tns="http://Component" xmlns:tns2="http://www.test.com/info"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <person>
-    <tns2:name>
-      <tns2:first>Will</tns2:first>
-      <tns2:last>Shakespeare</tns2:last>
-    </tns2:name>
+    <name>
+      <first>Will</first>
+      <last>Shakespeare</last>
+    </name>
   </person>
 </BOGUS>

Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/loadload-output.txt
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/loadload-output.txt?view=diff&rev=553836&r1=553835&r2=553836
==============================================================================
--- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/loadload-output.txt (original)
+++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/loadload-output.txt Fri Jul
 6 04:14:22 2007
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<company xmlns="companyNS" xsi:type="CompanyType" xmlns:tns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="ACME"><sdo:changeSummary xmlns:sdo="commonj.sdo" logging="true"><create>#/departments.0/employees.0/opendataobjectlist.0</create><create>#/departments.0/employees.0/opendataobject</create><create>#/departments.0/employees.0</create></sdo:changeSummary><departments
name="Advanced Technologies" location="NY" number="123"><employees name="Albert" SN="E0001"
openstring="Value Of Open String" openboolean="true"><openintlist>45</openintlist><opendataobjectlist
name="MyOpenName"/><opendataobject name="MyOpenName"/></employees><employees
name="Boris" SN="E0002" manager="true"/><employees name="Carl" SN="E0003"/></departments></company>
+<company xmlns="companyNS" xsi:type="CompanyType" xmlns:tns="companyNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="ACME"><sdo:changeSummary xmlns:sdo="commonj.sdo" logging="true"><create>#/departments.0/employees.0/opendataobjectlist.0</create><create>#/departments.0/employees.0/opendataobject</create><create>#/departments.0/employees.0</create></sdo:changeSummary><departments
name="Advanced Technologies" location="NY" number="123"><employees name="Albert" SN="E0001"
openstring="Value Of Open String" openboolean="true"><openintlist>45</openintlist><tns:opendataobjectlist
name="MyOpenName"/><tns:opendataobject name="MyOpenName"/></employees><employees
name="Boris" SN="E0002" manager="true"/><employees name="Carl" SN="E0003"/></departments></company>

Modified: incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/types.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/types.xsd?view=diff&rev=553836&r1=553835&r2=553836
==============================================================================
--- incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/types.xsd (original)
+++ incubator/tuscany/branches/sdo-cpp-pre2.1/runtime/core/test/types.xsd Fri Jul  6 04:14:22
2007
@@ -19,8 +19,7 @@
 -->
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:ns0="http://www.test.com/info"
-    targetNamespace="http://Component"
-    elementNameDefault="qualified">
+    targetNamespace="http://Component">
     <xs:import schemaLocation="person.xsd"
 namespace="http://www.test.com/info"/>
     <xs:element name="add">



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


Mime
View raw message