Hello there,
perhaps someone can help me understand the SDO spec as regards containment.
I use SDO’s with types statically defined in an XSD file. Some of these types
represent
dependent types that may have masters of different types. The masters of each
type
are represented by a list of “anyType”.
Containment prevents me from adding the same head object to the master lists of
different
slaves. So I want a non-containment property. The SDO spec talks about this on
p. 107, but my naive attempt to declare a non-containment list-property in my
XSD led
to an ArrayStoreException at runtime (when the head object is added to the
list).
I attach the complete XSD . Here are the excerpts of the two definitions of the
“masterObjects” property.
a) with containment (works as expected)
<complexType name="MasterType">
<!-- group the masters of each type together -->
<sequence>
<element name="masterObjects" type="anyType"
maxOccurs="unbounded"
minOccurs="0">
</element>
</sequence>
<attribute name="typeName" type="string"></attribute>
</complexType>
b) without containment (does not work)
<complexType name="MasterType">
<!-- group the masters of each type together -->
<sequence>
<element name="masterObjects" type="anyURI"
sdo:propertyType="anyType"
maxOccurs="unbounded" minOccurs="0"> </element>
</sequence>
<attribute name="typeName" type="string"></attribute>
</complexType>
Could anyone please point out the correct way to do this? If necessary, I can
provide a JUnit test case
that demonstrates what I need.
n Sebastian
IDS Scheer Consulting GmbH
Geschäftsführer/Managing Directors: Kamyar Niroumand, Ivo Totev
Sitz/Registered office: Altenkesseler Straße 17, 66115 Saarbrücken, Germany -
Registergericht/Commercial register: Saarbrücken HRB 19681
http://www.softwareag.com
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xsd/types"
xmlns:sdo="commonj.sdo" xmlns:tns="http://xsd/types">
<complexType name="MasterType">
<!-- group the masters of each type together -->
<sequence>
<element name="masterObjects" type="anyType" maxOccurs="unbounded"
minOccurs="0">
</element>
<!-- The following is an attempt to declare a non-containment property,
according to Java SDO Spec v2.1.0 p. 107, but fails with an ArrayStoreException -->
<!-- <element name="masterObjects" type="anyURI" sdo:propertyType="anyType"
maxOccurs="unbounded" minOccurs="0"> </element> -->
</sequence>
<attribute name="typeName" type="string"></attribute>
</complexType>
<complexType name="DependentObjectType">
<sequence>
<!-- each slave object can be dominated by several masters of different
types -->
<element name="masters" type="tns:MasterType" maxOccurs="unbounded"
minOccurs="0">
</element>
</sequence>
<attribute name="id" type="string"></attribute>
<attribute name="buyer_aid" type="string" default=""></attribute>
</complexType>
<complexType name="HeadObjectType">
<attribute name="id" type="string"></attribute>
<attribute name="displayName" type="string"></attribute>
</complexType>
</schema>