Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
Patch Available
Description
SDO 2.1.0 Specification define rules for XML generation of DataObject`s property defined by dynamic types (without XSD) that (part "10 Generation of XSD from SDO Type and Property" page 107):
===
An element is generated if property.many,
property.containment, or property.nullable is true, or if property.get(xmlElement) is
present and set to true, where xmlElement is an open content property in
commonj.sdo/xml. If the property is bidirectional and the opposite property has
containment=true, nothing is generated. Otherwise, an attribute is generated.
===
But Tuscany generates element by default. Attributes generated only for properties with corresponding xmlElement - the "many" and "nullable" properties dont checked.
XML documents generated for such DataObjects is not corresponds to XSD generated for their Types (XSDHelper.generate()). So, it is not possible to deserialize XML back to DataObject.
I have changed /org/apache/tuscany/sdo/helper/TypeHelperImpl.java method "void initializeProperty()" as follow:
====
— tuscany-sdo-1.1.1-src/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java 2008-07-10 16:53:42.000000000 +0400
+++ /patch/apache-tuscany-sdo-1.1.1/tuscany-sdo-1.1.1-src/impl/src/main/java/org/apache/tuscany/sdo/helper/TypeHelperImpl.java 2008-12-05 06:54:56.000000000 +0300
@@ -271,6 +271,12 @@
}
}
}
+
+ // Check for many and nullable
+ if (!newProperty.isMany() && !newProperty.isNullable())
+
if (!isXmlElement.booleanValue())
====
May be it is not very correct, but works for me ^)