You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Pinaki Poddar <pp...@bea.com> on 2007/07/02 22:03:29 UTC

How does one specify a Property as containment property in XML Schema?

Hello,

  How does one specify a Property as containment property in XML Schema?


  I was trying a simple example with a XML Schema (po.xsd) that had the
following snippet:

    <xsd:complexType name="PurchaseOrderType">
        <xsd:sequence>
            <xsd:element name="shipTo" type="USAddress"/>

  XSDHelper.INSTANCE.define(...) works fine to construct the types from
po.xsd.

  However when the following is executed:

 01: DataObject purchaseOrder =
DataFactory.INSTANCE.create("http://www.example.com/PO",
"PurchaseOrderType");
 02: DataObject shipTo = purchaseOrder.createDataObject("shipTo");

It fails with 
java.lang.IllegalArgumentException: The property 'shipTo' of
'PurchaseOrderType' isn't a containment
	at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:421)
	at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:467)
	at
org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
pl.java:1195)
	at test.TestModel.testInstance(TestModel.java:41)

  I am using tuscany-sdo-impl-1.0-incubating-beta1.jar.


Pinaki Poddar
972.834.2865


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

Re: How does one specify a Property as containment property in XML Schema?

Posted by kelvin goodson <ke...@gmail.com>.
Hi,
  this doesn't add up --- shipTo should be a containment Property.  Can you
post the whole schema/test code please? Attachments will be stripped from
the list,  so please copy inline into the email.
Regards, Kelvin.


On 02/07/07, Pinaki Poddar <pp...@bea.com> wrote:
>
> Hello,
>
> How does one specify a Property as containment property in XML Schema?
>
>
> I was trying a simple example with a XML Schema (po.xsd) that had the
> following snippet:
>
>    <xsd:complexType name="PurchaseOrderType">
>        <xsd:sequence>
>            <xsd:element name="shipTo" type="USAddress"/>
>
> XSDHelper.INSTANCE.define(...) works fine to construct the types from
> po.xsd.
>
> However when the following is executed:
>
> 01: DataObject purchaseOrder =
> DataFactory.INSTANCE.create("http://www.example.com/PO",
> "PurchaseOrderType");
> 02: DataObject shipTo = purchaseOrder.createDataObject("shipTo");
>
> It fails with
> java.lang.IllegalArgumentException: The property 'shipTo' of
> 'PurchaseOrderType' isn't a containment
>        at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> il.java:421)
>        at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> il.java:467)
>        at
> org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
> pl.java:1195)
>        at test.TestModel.testInstance(TestModel.java:41)
>
> I am using tuscany-sdo-impl-1.0-incubating-beta1.jar.
>
>
> Pinaki Poddar
> 972.834.2865
>
>
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual or
> entity named in this message. If you are not the intended recipient, and
> have received this message in error, please immediately return this by email
> and then delete it.

Re: How does one specify a Property as containment property in XML Schema?

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Or better yet would be to add the po: to the types where it's missing:

>             <xsd:element name="shipTo" type="USAddress"/>
>             <xsd:element name="billTo" type="USAddress"/>
>             <xsd:element name="items"  type="Items"/>

like this:

>             <xsd:element name="shipTo" type="po:USAddress"/>
>             <xsd:element name="billTo" type="po:USAddress"/>
>             <xsd:element name="items"  type="po:Items"/>

The problem is that XSDHelper.define() doesn't complain about errors like 
this, it just treats type="USAddress" as an unknown type.

Frank.


kelvingoodson@gmail.com wrote on 07/03/2007 07:29:40 AM:

> Pinaki,
> 
>  there are errors in the schema you are using.  If you remove the ":po" 
from
> xmlns:po="http://www.example.com/PO" and remove "po:" from the rest of 
the
> file,  when used in referencing type or element definitions,  then your 
test
> code succeeds.
> 
> Regards,Kelvin.
> 
> 
> Regards, Kelvin.
> 
> On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
> >
> > I switched to EMF core API. The same error. Looks like Tuscany SDO is
> > wrapping EMF core -- is that right?
> >
> >
> >
> > Pinaki Poddar
> > 972.834.2865
> >
> > -----Original Message-----
> > From: kelvin goodson [mailto:kelvingoodson@gmail.com]
> > Sent: Tuesday, July 03, 2007 3:54 AM
> > To: tuscany-dev@ws.apache.org
> > Subject: Re: How does one specify a Property as containment property 
in
> > XML Schema?
> >
> > Pinaki,
> >   perfect, thanks (yes, the attachments are stripped by the list), 
will
> > try them out soon.
> > Kelvin
> >
> > On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
> > >
> > > Are you not seeing the e-mail attachements TestSDO.java and po.xsd?
> > >
> > > In any case, here they are
> > > ========================= TestSDO.java
> > > ======================================================
> > >
> > > package test;
> > >
> > > import java.io.IOException;
> > > import java.io.InputStream;
> > > import java.io.OutputStream;
> > > import java.util.List;
> > >
> > > import javax.persistence.EntityManager; import
> > > javax.persistence.EntityManagerFactory;
> > > import javax.persistence.Persistence;
> > >
> > > import org.apache.tuscany.sdo.helper.HelperProviderImpl;
> > >
> > > import com.bea.jpa.SDOEntityManager;
> > > import com.bea.jpa.SDOEntityManagerFactory;
> > >
> > > import commonj.sdo.DataObject;
> > > import commonj.sdo.helper.DataFactory; import
> > > commonj.sdo.helper.XMLHelper; import commonj.sdo.helper.XSDHelper;
> > > import commonj.sdo.impl.HelperProvider;
> > >
> > > import junit.framework.TestCase;
> > >
> > > /**
> > > * JUnit Tests to read a meta-model from XML Schema and create
> > > instances
> > > * according to the meta-model.
> > > *
> > > * @author ppoddar
> > > *
> > > */
> > > public class TestSDO extends TestCase {
> > >         private static final String RESOURCE_SDO_MODEL  = "po.xsd";
> > >         private static final String SDO_MODEL_NAMESPACE =
> > > "http://www.example.com/PO";
> > >
> > >         /**
> > >          * Create a SDO MetaData Model from a XML Schema and 
populate
> > > instances.
> > >          * Assumes 'po.xsd' be available in classpath as resource.
> > >          *
> > >          */
> > >         public void testCreateModel() {
> > >                 InputStream xsdInputStream =
> > > this.getClass().getClassLoader()
> > >
> > > .getResourceAsStream(RESOURCE_SDO_MODEL);
> > >                 assertNotNull(xsdInputStream);
> > >
> > >                 String schemaLocation = null;
> > >                 List/* <Type> */types =
> > > XSDHelper.INSTANCE.define(xsdInputStream,
> > >                                 schemaLocation);
> > >                 assertTrue(types != null && !types.isEmpty());
> > >                 assertTrue(types.size() >= 2);
> > >
> > >                 DataObject purchaseOrder =
> > DataFactory.INSTANCE.create(
> > >                                 SDO_MODEL_NAMESPACE,
> > > "PurchaseOrderType");
> > >
> > >                 purchaseOrder.setString("orderDate", "1999-10-20");
> > >
> > >                 DataObject shipTo =
> > > purchaseOrder.createDataObject("shipTo");
> > >                 shipTo.set("country", "US");
> > >                 shipTo.set("name", "Alice Smith");
> > >                 shipTo.set("street", "123 Maple Street");
> > >                 shipTo.set("city", "Mill Valley");
> > >                 shipTo.set("state", "CA");
> > >                 shipTo.setString("zip", "90952");
> > >                 DataObject billTo =
> > > purchaseOrder.createDataObject("billTo");
> > >                 billTo.set("country", "US");
> > >                 billTo.set("name", "Robert Smith");
> > >                 billTo.set("street", "8 Oak Avenue");
> > >                 billTo.set("city", "Mill Valley");
> > >                 billTo.set("state", "PA");
> > >                 billTo.setString("zip", "95819");
> > >                 purchaseOrder.set("comment", "Hurry, my lawn is 
going
> > > wild!");
> > >
> > >                 DataObject items =
> > > purchaseOrder.createDataObject("items");
> > >
> > >                 DataObject item1 = items.createDataObject("item");
> > >                 item1.set("partNum", "872-AA");
> > >                 item1.set("productName", "Lawnmower");
> > >                 item1.setInt("quantity", 1);
> > >                 item1.setString("USPrice", "148.95");
> > >                 item1.set("comment", "Confirm this is electric");
> > >
> > >                 DataObject item2 = items.createDataObject("item");
> > >                 item2.set("partNum", "926-AA");
> > >                 item2.set("productName", "Baby Monitor");
> > >                 item2.setInt("quantity", 1);
> > >                 item2.setString("USPrice", "39.98");
> > >                 item2.setString("shipDate", "1999-05-21");
> > >
> > >                 try {
> > >                         OutputStream stream = System.err;
> > >                         XMLHelper.INSTANCE.save(purchaseOrder,
> > > SDO_MODEL_NAMESPACE,
> > >                                         "purchaseOrder", stream);
> > >                 } catch (IOException e) {
> > >                         e.printStackTrace();
> > >                         fail();
> > >                 }
> > >         }
> > >
> > > }
> > >
> > > 
======================================================================
> > > ==
> > > ===========================
> > > XML Schema Definition: po.xsd
> > > 
======================================================================
> > > ==
> > > ===========================
> > > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > >     xmlns:po="http://www.example.com/PO"
> > > targetNamespace="http://www.example.com/PO">
> > >
> > >     <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
> > >     <xsd:element name="comment" type="xsd:string"/>
> > >
> > >     <xsd:complexType name="PurchaseOrderType">
> > >         <xsd:sequence>
> > >             <xsd:element name="shipTo" type="USAddress"/>
> > >             <xsd:element name="billTo" type="USAddress"/>
> > >             <xsd:element ref="po:comment" minOccurs="0"/>
> > >             <xsd:element name="items"  type="Items"/>
> > >         </xsd:sequence>
> > >         <xsd:attribute name="orderDate" type="xsd:date"/>
> > >     </xsd:complexType>
> > >
> > >     <xsd:complexType name="USAddress">
> > >         <xsd:sequence>
> > >             <xsd:element name="name"   type="xsd:string"/>
> > >             <xsd:element name="street" type="xsd:string"/>
> > >             <xsd:element name="city"   type="xsd:string"/>
> > >             <xsd:element name="state"  type="xsd:string"/>
> > >             <xsd:element name="zip"    type="xsd:decimal"/>
> > >         </xsd:sequence>
> > >         <xsd:attribute name="country" type="xsd:NMTOKEN" 
fixed="US"/>
> > >     </xsd:complexType>
> > >
> > >     <xsd:complexType name="Items">
> > >         <xsd:sequence>
> > >             <xsd:element name="item" minOccurs="0"
> > > maxOccurs="unbounded">
> > >                 <xsd:complexType>
> > >                     <xsd:sequence>
> > >                         <xsd:element name="productName"
> > > type="xsd:string"/>
> > >                         <xsd:element name="quantity">
> > >                             <xsd:simpleType>
> > >                                 <xsd:restriction
> > > base="xsd:positiveInteger">
> > >                                     <xsd:maxExclusive value="100"/>
> > >                                 </xsd:restriction>
> > >                             </xsd:simpleType>
> > >                         </xsd:element>
> > >                         <xsd:element name="USPrice"
> > > type="xsd:decimal"/>
> > >                         <xsd:element ref="po:comment"
> > minOccurs="0"/>
> > >                         <xsd:element name="shipDate" type="xsd:date"
> > > minOccurs="0"/>
> > >                     </xsd:sequence>
> > >                     <xsd:attribute name="partNum" type="po:SKU"
> > > use="required"/>
> > >                 </xsd:complexType>
> > >             </xsd:element>
> > >         </xsd:sequence>
> > >     </xsd:complexType>
> > >     <xsd:simpleType name="SKU">
> > >         <xsd:restriction base="xsd:string">
> > >             <xsd:pattern value="\d{3}-[A-Z]{2}"/>
> > >         </xsd:restriction>
> > >     </xsd:simpleType>
> > > </xsd:schema>
> > >
> > > Pinaki Poddar
> > > 972.834.2865
> > >
> > > -----Original Message-----
> > > From: kelvingoodson@gmail.com [mailto:kelvingoodson@gmail.com] On
> > > Behalf Of kelvin goodson
> > > Sent: Tuesday, July 03, 2007 3:43 AM
> > > To: tuscany-dev@ws.apache.org
> > > Subject: Re: How does one specify a Property as containment property
> > > in XML Schema?
> > >
> > > Hi Pinaki,
> > > I'm not sure if we are not understanding each other here,  or 
whether
> > > technology is conspiring against us,  but what I'd like to do is to
> > > execute the test code you are running myself, so please could you
> > > paste the code of your test program.
> > > Regards,Kelvin.
> > >
> > >
> > > Notice:  This email message, together with any attachments, may
> > > contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > > affiliated entities,  that may be confidential,  proprietary,
> > > copyrighted  and/or legally privileged, and is intended solely for 
the
> >
> > > use of the individual or entity named in this message. If you are 
not
> > > the intended recipient, and have received this message in error,
> > > please immediately return this by email and then delete it.
> > >
> > > 
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> > >
> > >
> >
> > Notice:  This email message, together with any attachments, may 
contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and affiliated
> > entities,  that may be confidential,  proprietary,  copyrighted and/or
> > legally privileged, and is intended solely for the use of the 
individual or
> > entity named in this message. If you are not the intended recipient, 
and
> > have received this message in error, please immediately return this by 
email
> > and then delete it.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
> >


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


Re: How does one specify a Property as containment property in XML Schema?

Posted by kelvin goodson <ke...@thegoodsons.org.uk>.
Pinaki,

 there are errors in the schema you are using.  If you remove the ":po" from
xmlns:po="http://www.example.com/PO" and remove "po:" from the rest of the
file,  when used in referencing type or element definitions,  then your test
code succeeds.

Regards,Kelvin.


Regards, Kelvin.

On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
>
> I switched to EMF core API. The same error. Looks like Tuscany SDO is
> wrapping EMF core -- is that right?
>
>
>
> Pinaki Poddar
> 972.834.2865
>
> -----Original Message-----
> From: kelvin goodson [mailto:kelvingoodson@gmail.com]
> Sent: Tuesday, July 03, 2007 3:54 AM
> To: tuscany-dev@ws.apache.org
> Subject: Re: How does one specify a Property as containment property in
> XML Schema?
>
> Pinaki,
>   perfect, thanks (yes, the attachments are stripped by the list),  will
> try them out soon.
> Kelvin
>
> On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
> >
> > Are you not seeing the e-mail attachements TestSDO.java and po.xsd?
> >
> > In any case, here they are
> > ========================= TestSDO.java
> > ======================================================
> >
> > package test;
> >
> > import java.io.IOException;
> > import java.io.InputStream;
> > import java.io.OutputStream;
> > import java.util.List;
> >
> > import javax.persistence.EntityManager; import
> > javax.persistence.EntityManagerFactory;
> > import javax.persistence.Persistence;
> >
> > import org.apache.tuscany.sdo.helper.HelperProviderImpl;
> >
> > import com.bea.jpa.SDOEntityManager;
> > import com.bea.jpa.SDOEntityManagerFactory;
> >
> > import commonj.sdo.DataObject;
> > import commonj.sdo.helper.DataFactory; import
> > commonj.sdo.helper.XMLHelper; import commonj.sdo.helper.XSDHelper;
> > import commonj.sdo.impl.HelperProvider;
> >
> > import junit.framework.TestCase;
> >
> > /**
> > * JUnit Tests to read a meta-model from XML Schema and create
> > instances
> > * according to the meta-model.
> > *
> > * @author ppoddar
> > *
> > */
> > public class TestSDO extends TestCase {
> >         private static final String RESOURCE_SDO_MODEL  = "po.xsd";
> >         private static final String SDO_MODEL_NAMESPACE =
> > "http://www.example.com/PO";
> >
> >         /**
> >          * Create a SDO MetaData Model from a XML Schema and populate
> > instances.
> >          * Assumes 'po.xsd' be available in classpath as resource.
> >          *
> >          */
> >         public void testCreateModel() {
> >                 InputStream xsdInputStream =
> > this.getClass().getClassLoader()
> >
> > .getResourceAsStream(RESOURCE_SDO_MODEL);
> >                 assertNotNull(xsdInputStream);
> >
> >                 String schemaLocation = null;
> >                 List/* <Type> */types =
> > XSDHelper.INSTANCE.define(xsdInputStream,
> >                                 schemaLocation);
> >                 assertTrue(types != null && !types.isEmpty());
> >                 assertTrue(types.size() >= 2);
> >
> >                 DataObject purchaseOrder =
> DataFactory.INSTANCE.create(
> >                                 SDO_MODEL_NAMESPACE,
> > "PurchaseOrderType");
> >
> >                 purchaseOrder.setString("orderDate", "1999-10-20");
> >
> >                 DataObject shipTo =
> > purchaseOrder.createDataObject("shipTo");
> >                 shipTo.set("country", "US");
> >                 shipTo.set("name", "Alice Smith");
> >                 shipTo.set("street", "123 Maple Street");
> >                 shipTo.set("city", "Mill Valley");
> >                 shipTo.set("state", "CA");
> >                 shipTo.setString("zip", "90952");
> >                 DataObject billTo =
> > purchaseOrder.createDataObject("billTo");
> >                 billTo.set("country", "US");
> >                 billTo.set("name", "Robert Smith");
> >                 billTo.set("street", "8 Oak Avenue");
> >                 billTo.set("city", "Mill Valley");
> >                 billTo.set("state", "PA");
> >                 billTo.setString("zip", "95819");
> >                 purchaseOrder.set("comment", "Hurry, my lawn is going
> > wild!");
> >
> >                 DataObject items =
> > purchaseOrder.createDataObject("items");
> >
> >                 DataObject item1 = items.createDataObject("item");
> >                 item1.set("partNum", "872-AA");
> >                 item1.set("productName", "Lawnmower");
> >                 item1.setInt("quantity", 1);
> >                 item1.setString("USPrice", "148.95");
> >                 item1.set("comment", "Confirm this is electric");
> >
> >                 DataObject item2 = items.createDataObject("item");
> >                 item2.set("partNum", "926-AA");
> >                 item2.set("productName", "Baby Monitor");
> >                 item2.setInt("quantity", 1);
> >                 item2.setString("USPrice", "39.98");
> >                 item2.setString("shipDate", "1999-05-21");
> >
> >                 try {
> >                         OutputStream stream = System.err;
> >                         XMLHelper.INSTANCE.save(purchaseOrder,
> > SDO_MODEL_NAMESPACE,
> >                                         "purchaseOrder", stream);
> >                 } catch (IOException e) {
> >                         e.printStackTrace();
> >                         fail();
> >                 }
> >         }
> >
> > }
> >
> > ======================================================================
> > ==
> > ===========================
> > XML Schema Definition: po.xsd
> > ======================================================================
> > ==
> > ===========================
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >     xmlns:po="http://www.example.com/PO"
> > targetNamespace="http://www.example.com/PO">
> >
> >     <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
> >     <xsd:element name="comment" type="xsd:string"/>
> >
> >     <xsd:complexType name="PurchaseOrderType">
> >         <xsd:sequence>
> >             <xsd:element name="shipTo" type="USAddress"/>
> >             <xsd:element name="billTo" type="USAddress"/>
> >             <xsd:element ref="po:comment" minOccurs="0"/>
> >             <xsd:element name="items"  type="Items"/>
> >         </xsd:sequence>
> >         <xsd:attribute name="orderDate" type="xsd:date"/>
> >     </xsd:complexType>
> >
> >     <xsd:complexType name="USAddress">
> >         <xsd:sequence>
> >             <xsd:element name="name"   type="xsd:string"/>
> >             <xsd:element name="street" type="xsd:string"/>
> >             <xsd:element name="city"   type="xsd:string"/>
> >             <xsd:element name="state"  type="xsd:string"/>
> >             <xsd:element name="zip"    type="xsd:decimal"/>
> >         </xsd:sequence>
> >         <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
> >     </xsd:complexType>
> >
> >     <xsd:complexType name="Items">
> >         <xsd:sequence>
> >             <xsd:element name="item" minOccurs="0"
> > maxOccurs="unbounded">
> >                 <xsd:complexType>
> >                     <xsd:sequence>
> >                         <xsd:element name="productName"
> > type="xsd:string"/>
> >                         <xsd:element name="quantity">
> >                             <xsd:simpleType>
> >                                 <xsd:restriction
> > base="xsd:positiveInteger">
> >                                     <xsd:maxExclusive value="100"/>
> >                                 </xsd:restriction>
> >                             </xsd:simpleType>
> >                         </xsd:element>
> >                         <xsd:element name="USPrice"
> > type="xsd:decimal"/>
> >                         <xsd:element ref="po:comment"
> minOccurs="0"/>
> >                         <xsd:element name="shipDate" type="xsd:date"
> > minOccurs="0"/>
> >                     </xsd:sequence>
> >                     <xsd:attribute name="partNum" type="po:SKU"
> > use="required"/>
> >                 </xsd:complexType>
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:simpleType name="SKU">
> >         <xsd:restriction base="xsd:string">
> >             <xsd:pattern value="\d{3}-[A-Z]{2}"/>
> >         </xsd:restriction>
> >     </xsd:simpleType>
> > </xsd:schema>
> >
> > Pinaki Poddar
> > 972.834.2865
> >
> > -----Original Message-----
> > From: kelvingoodson@gmail.com [mailto:kelvingoodson@gmail.com] On
> > Behalf Of kelvin goodson
> > Sent: Tuesday, July 03, 2007 3:43 AM
> > To: tuscany-dev@ws.apache.org
> > Subject: Re: How does one specify a Property as containment property
> > in XML Schema?
> >
> > Hi Pinaki,
> > I'm not sure if we are not understanding each other here,  or whether
> > technology is conspiring against us,  but what I'd like to do is to
> > execute the test code you are running myself, so please could you
> > paste the code of your test program.
> > Regards,Kelvin.
> >
> >
> > Notice:  This email message, together with any attachments, may
> > contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > affiliated entities,  that may be confidential,  proprietary,
> > copyrighted  and/or legally privileged, and is intended solely for the
>
> > use of the individual or entity named in this message. If you are not
> > the intended recipient, and have received this message in error,
> > please immediately return this by email and then delete it.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
> >
>
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual or
> entity named in this message. If you are not the intended recipient, and
> have received this message in error, please immediately return this by email
> and then delete it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>

RE: How does one specify a Property as containment property in XML Schema?

Posted by Pinaki Poddar <pp...@bea.com>.
I switched to EMF core API. The same error. Looks like Tuscany SDO is
wrapping EMF core -- is that right?
 


Pinaki Poddar
972.834.2865

-----Original Message-----
From: kelvin goodson [mailto:kelvingoodson@gmail.com] 
Sent: Tuesday, July 03, 2007 3:54 AM
To: tuscany-dev@ws.apache.org
Subject: Re: How does one specify a Property as containment property in
XML Schema?

Pinaki,
  perfect, thanks (yes, the attachments are stripped by the list),  will
try them out soon.
Kelvin

On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
>
> Are you not seeing the e-mail attachements TestSDO.java and po.xsd?
>
> In any case, here they are
> ========================= TestSDO.java 
> ======================================================
>
> package test;
>
> import java.io.IOException;
> import java.io.InputStream;
> import java.io.OutputStream;
> import java.util.List;
>
> import javax.persistence.EntityManager; import 
> javax.persistence.EntityManagerFactory;
> import javax.persistence.Persistence;
>
> import org.apache.tuscany.sdo.helper.HelperProviderImpl;
>
> import com.bea.jpa.SDOEntityManager;
> import com.bea.jpa.SDOEntityManagerFactory;
>
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.DataFactory; import 
> commonj.sdo.helper.XMLHelper; import commonj.sdo.helper.XSDHelper; 
> import commonj.sdo.impl.HelperProvider;
>
> import junit.framework.TestCase;
>
> /**
> * JUnit Tests to read a meta-model from XML Schema and create 
> instances
> * according to the meta-model.
> *
> * @author ppoddar
> *
> */
> public class TestSDO extends TestCase {
>         private static final String RESOURCE_SDO_MODEL  = "po.xsd";
>         private static final String SDO_MODEL_NAMESPACE = 
> "http://www.example.com/PO";
>
>         /**
>          * Create a SDO MetaData Model from a XML Schema and populate 
> instances.
>          * Assumes 'po.xsd' be available in classpath as resource.
>          *
>          */
>         public void testCreateModel() {
>                 InputStream xsdInputStream =
> this.getClass().getClassLoader()
>
> .getResourceAsStream(RESOURCE_SDO_MODEL);
>                 assertNotNull(xsdInputStream);
>
>                 String schemaLocation = null;
>                 List/* <Type> */types = 
> XSDHelper.INSTANCE.define(xsdInputStream,
>                                 schemaLocation);
>                 assertTrue(types != null && !types.isEmpty());
>                 assertTrue(types.size() >= 2);
>
>                 DataObject purchaseOrder =
DataFactory.INSTANCE.create(
>                                 SDO_MODEL_NAMESPACE, 
> "PurchaseOrderType");
>
>                 purchaseOrder.setString("orderDate", "1999-10-20");
>
>                 DataObject shipTo =
> purchaseOrder.createDataObject("shipTo");
>                 shipTo.set("country", "US");
>                 shipTo.set("name", "Alice Smith");
>                 shipTo.set("street", "123 Maple Street");
>                 shipTo.set("city", "Mill Valley");
>                 shipTo.set("state", "CA");
>                 shipTo.setString("zip", "90952");
>                 DataObject billTo =
> purchaseOrder.createDataObject("billTo");
>                 billTo.set("country", "US");
>                 billTo.set("name", "Robert Smith");
>                 billTo.set("street", "8 Oak Avenue");
>                 billTo.set("city", "Mill Valley");
>                 billTo.set("state", "PA");
>                 billTo.setString("zip", "95819");
>                 purchaseOrder.set("comment", "Hurry, my lawn is going 
> wild!");
>
>                 DataObject items =
> purchaseOrder.createDataObject("items");
>
>                 DataObject item1 = items.createDataObject("item");
>                 item1.set("partNum", "872-AA");
>                 item1.set("productName", "Lawnmower");
>                 item1.setInt("quantity", 1);
>                 item1.setString("USPrice", "148.95");
>                 item1.set("comment", "Confirm this is electric");
>
>                 DataObject item2 = items.createDataObject("item");
>                 item2.set("partNum", "926-AA");
>                 item2.set("productName", "Baby Monitor");
>                 item2.setInt("quantity", 1);
>                 item2.setString("USPrice", "39.98");
>                 item2.setString("shipDate", "1999-05-21");
>
>                 try {
>                         OutputStream stream = System.err;
>                         XMLHelper.INSTANCE.save(purchaseOrder,
> SDO_MODEL_NAMESPACE,
>                                         "purchaseOrder", stream);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                         fail();
>                 }
>         }
>
> }
>
> ======================================================================
> ==
> ===========================
> XML Schema Definition: po.xsd
> ======================================================================
> ==
> ===========================
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>     xmlns:po="http://www.example.com/PO"
> targetNamespace="http://www.example.com/PO">
>
>     <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
>     <xsd:element name="comment" type="xsd:string"/>
>
>     <xsd:complexType name="PurchaseOrderType">
>         <xsd:sequence>
>             <xsd:element name="shipTo" type="USAddress"/>
>             <xsd:element name="billTo" type="USAddress"/>
>             <xsd:element ref="po:comment" minOccurs="0"/>
>             <xsd:element name="items"  type="Items"/>
>         </xsd:sequence>
>         <xsd:attribute name="orderDate" type="xsd:date"/>
>     </xsd:complexType>
>
>     <xsd:complexType name="USAddress">
>         <xsd:sequence>
>             <xsd:element name="name"   type="xsd:string"/>
>             <xsd:element name="street" type="xsd:string"/>
>             <xsd:element name="city"   type="xsd:string"/>
>             <xsd:element name="state"  type="xsd:string"/>
>             <xsd:element name="zip"    type="xsd:decimal"/>
>         </xsd:sequence>
>         <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
>     </xsd:complexType>
>
>     <xsd:complexType name="Items">
>         <xsd:sequence>
>             <xsd:element name="item" minOccurs="0"
> maxOccurs="unbounded">
>                 <xsd:complexType>
>                     <xsd:sequence>
>                         <xsd:element name="productName"
> type="xsd:string"/>
>                         <xsd:element name="quantity">
>                             <xsd:simpleType>
>                                 <xsd:restriction 
> base="xsd:positiveInteger">
>                                     <xsd:maxExclusive value="100"/>
>                                 </xsd:restriction>
>                             </xsd:simpleType>
>                         </xsd:element>
>                         <xsd:element name="USPrice"
> type="xsd:decimal"/>
>                         <xsd:element ref="po:comment"
minOccurs="0"/>
>                         <xsd:element name="shipDate" type="xsd:date"
> minOccurs="0"/>
>                     </xsd:sequence>
>                     <xsd:attribute name="partNum" type="po:SKU"
> use="required"/>
>                 </xsd:complexType>
>             </xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:simpleType name="SKU">
>         <xsd:restriction base="xsd:string">
>             <xsd:pattern value="\d{3}-[A-Z]{2}"/>
>         </xsd:restriction>
>     </xsd:simpleType>
> </xsd:schema>
>
> Pinaki Poddar
> 972.834.2865
>
> -----Original Message-----
> From: kelvingoodson@gmail.com [mailto:kelvingoodson@gmail.com] On 
> Behalf Of kelvin goodson
> Sent: Tuesday, July 03, 2007 3:43 AM
> To: tuscany-dev@ws.apache.org
> Subject: Re: How does one specify a Property as containment property 
> in XML Schema?
>
> Hi Pinaki,
> I'm not sure if we are not understanding each other here,  or whether 
> technology is conspiring against us,  but what I'd like to do is to 
> execute the test code you are running myself, so please could you 
> paste the code of your test program.
> Regards,Kelvin.
>
>
> Notice:  This email message, together with any attachments, may 
> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  
> affiliated entities,  that may be confidential,  proprietary,  
> copyrighted  and/or legally privileged, and is intended solely for the

> use of the individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in error, 
> please immediately return this by email and then delete it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

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


Re: How does one specify a Property as containment property in XML Schema?

Posted by kelvin goodson <ke...@gmail.com>.
Pinaki,
  perfect, thanks (yes, the attachments are stripped by the list),  will try
them out soon.
Kelvin

On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
>
> Are you not seeing the e-mail attachements TestSDO.java and po.xsd?
>
> In any case, here they are
> ========================= TestSDO.java
> ======================================================
>
> package test;
>
> import java.io.IOException;
> import java.io.InputStream;
> import java.io.OutputStream;
> import java.util.List;
>
> import javax.persistence.EntityManager;
> import javax.persistence.EntityManagerFactory;
> import javax.persistence.Persistence;
>
> import org.apache.tuscany.sdo.helper.HelperProviderImpl;
>
> import com.bea.jpa.SDOEntityManager;
> import com.bea.jpa.SDOEntityManagerFactory;
>
> import commonj.sdo.DataObject;
> import commonj.sdo.helper.DataFactory;
> import commonj.sdo.helper.XMLHelper;
> import commonj.sdo.helper.XSDHelper;
> import commonj.sdo.impl.HelperProvider;
>
> import junit.framework.TestCase;
>
> /**
> * JUnit Tests to read a meta-model from XML Schema and create instances
> * according to the meta-model.
> *
> * @author ppoddar
> *
> */
> public class TestSDO extends TestCase {
>         private static final String RESOURCE_SDO_MODEL  = "po.xsd";
>         private static final String SDO_MODEL_NAMESPACE =
> "http://www.example.com/PO";
>
>         /**
>          * Create a SDO MetaData Model from a XML Schema and populate
> instances.
>          * Assumes 'po.xsd' be available in classpath as resource.
>          *
>          */
>         public void testCreateModel() {
>                 InputStream xsdInputStream =
> this.getClass().getClassLoader()
>
> .getResourceAsStream(RESOURCE_SDO_MODEL);
>                 assertNotNull(xsdInputStream);
>
>                 String schemaLocation = null;
>                 List/* <Type> */types =
> XSDHelper.INSTANCE.define(xsdInputStream,
>                                 schemaLocation);
>                 assertTrue(types != null && !types.isEmpty());
>                 assertTrue(types.size() >= 2);
>
>                 DataObject purchaseOrder = DataFactory.INSTANCE.create(
>                                 SDO_MODEL_NAMESPACE,
> "PurchaseOrderType");
>
>                 purchaseOrder.setString("orderDate", "1999-10-20");
>
>                 DataObject shipTo =
> purchaseOrder.createDataObject("shipTo");
>                 shipTo.set("country", "US");
>                 shipTo.set("name", "Alice Smith");
>                 shipTo.set("street", "123 Maple Street");
>                 shipTo.set("city", "Mill Valley");
>                 shipTo.set("state", "CA");
>                 shipTo.setString("zip", "90952");
>                 DataObject billTo =
> purchaseOrder.createDataObject("billTo");
>                 billTo.set("country", "US");
>                 billTo.set("name", "Robert Smith");
>                 billTo.set("street", "8 Oak Avenue");
>                 billTo.set("city", "Mill Valley");
>                 billTo.set("state", "PA");
>                 billTo.setString("zip", "95819");
>                 purchaseOrder.set("comment", "Hurry, my lawn is going
> wild!");
>
>                 DataObject items =
> purchaseOrder.createDataObject("items");
>
>                 DataObject item1 = items.createDataObject("item");
>                 item1.set("partNum", "872-AA");
>                 item1.set("productName", "Lawnmower");
>                 item1.setInt("quantity", 1);
>                 item1.setString("USPrice", "148.95");
>                 item1.set("comment", "Confirm this is electric");
>
>                 DataObject item2 = items.createDataObject("item");
>                 item2.set("partNum", "926-AA");
>                 item2.set("productName", "Baby Monitor");
>                 item2.setInt("quantity", 1);
>                 item2.setString("USPrice", "39.98");
>                 item2.setString("shipDate", "1999-05-21");
>
>                 try {
>                         OutputStream stream = System.err;
>                         XMLHelper.INSTANCE.save(purchaseOrder,
> SDO_MODEL_NAMESPACE,
>                                         "purchaseOrder", stream);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                         fail();
>                 }
>         }
>
> }
>
> ========================================================================
> ===========================
> XML Schema Definition: po.xsd
> ========================================================================
> ===========================
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>     xmlns:po="http://www.example.com/PO"
> targetNamespace="http://www.example.com/PO">
>
>     <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
>     <xsd:element name="comment" type="xsd:string"/>
>
>     <xsd:complexType name="PurchaseOrderType">
>         <xsd:sequence>
>             <xsd:element name="shipTo" type="USAddress"/>
>             <xsd:element name="billTo" type="USAddress"/>
>             <xsd:element ref="po:comment" minOccurs="0"/>
>             <xsd:element name="items"  type="Items"/>
>         </xsd:sequence>
>         <xsd:attribute name="orderDate" type="xsd:date"/>
>     </xsd:complexType>
>
>     <xsd:complexType name="USAddress">
>         <xsd:sequence>
>             <xsd:element name="name"   type="xsd:string"/>
>             <xsd:element name="street" type="xsd:string"/>
>             <xsd:element name="city"   type="xsd:string"/>
>             <xsd:element name="state"  type="xsd:string"/>
>             <xsd:element name="zip"    type="xsd:decimal"/>
>         </xsd:sequence>
>         <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
>     </xsd:complexType>
>
>     <xsd:complexType name="Items">
>         <xsd:sequence>
>             <xsd:element name="item" minOccurs="0"
> maxOccurs="unbounded">
>                 <xsd:complexType>
>                     <xsd:sequence>
>                         <xsd:element name="productName"
> type="xsd:string"/>
>                         <xsd:element name="quantity">
>                             <xsd:simpleType>
>                                 <xsd:restriction
> base="xsd:positiveInteger">
>                                     <xsd:maxExclusive value="100"/>
>                                 </xsd:restriction>
>                             </xsd:simpleType>
>                         </xsd:element>
>                         <xsd:element name="USPrice"
> type="xsd:decimal"/>
>                         <xsd:element ref="po:comment"   minOccurs="0"/>
>                         <xsd:element name="shipDate" type="xsd:date"
> minOccurs="0"/>
>                     </xsd:sequence>
>                     <xsd:attribute name="partNum" type="po:SKU"
> use="required"/>
>                 </xsd:complexType>
>             </xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:simpleType name="SKU">
>         <xsd:restriction base="xsd:string">
>             <xsd:pattern value="\d{3}-[A-Z]{2}"/>
>         </xsd:restriction>
>     </xsd:simpleType>
> </xsd:schema>
>
> Pinaki Poddar
> 972.834.2865
>
> -----Original Message-----
> From: kelvingoodson@gmail.com [mailto:kelvingoodson@gmail.com] On Behalf
> Of kelvin goodson
> Sent: Tuesday, July 03, 2007 3:43 AM
> To: tuscany-dev@ws.apache.org
> Subject: Re: How does one specify a Property as containment property in
> XML Schema?
>
> Hi Pinaki,
> I'm not sure if we are not understanding each other here,  or whether
> technology is conspiring against us,  but what I'd like to do is to
> execute the test code you are running myself, so please could you paste
> the code of your test program.
> Regards,Kelvin.
>
>
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual or
> entity named in this message. If you are not the intended recipient, and
> have received this message in error, please immediately return this by email
> and then delete it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>

RE: How does one specify a Property as containment property in XML Schema?

Posted by Pinaki Poddar <pp...@bea.com>.
Are you not seeing the e-mail attachements TestSDO.java and po.xsd?

In any case, here they are
========================= TestSDO.java
======================================================

package test;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.apache.tuscany.sdo.helper.HelperProviderImpl;

import com.bea.jpa.SDOEntityManager;
import com.bea.jpa.SDOEntityManagerFactory;

import commonj.sdo.DataObject;
import commonj.sdo.helper.DataFactory;
import commonj.sdo.helper.XMLHelper;
import commonj.sdo.helper.XSDHelper;
import commonj.sdo.impl.HelperProvider;

import junit.framework.TestCase;

/**
 * JUnit Tests to read a meta-model from XML Schema and create instances
 * according to the meta-model.
 * 
 * @author ppoddar
 *
 */
public class TestSDO extends TestCase {
	private static final String RESOURCE_SDO_MODEL  = "po.xsd";
	private static final String SDO_MODEL_NAMESPACE =
"http://www.example.com/PO";

	/**
	 * Create a SDO MetaData Model from a XML Schema and populate
instances.
	 * Assumes 'po.xsd' be available in classpath as resource.
	 * 
	 */
	public void testCreateModel() {
		InputStream xsdInputStream =
this.getClass().getClassLoader()
	
.getResourceAsStream(RESOURCE_SDO_MODEL);
		assertNotNull(xsdInputStream);
		
		String schemaLocation = null; 
		List/* <Type> */types =
XSDHelper.INSTANCE.define(xsdInputStream,
				schemaLocation);
		assertTrue(types != null && !types.isEmpty());
		assertTrue(types.size() >= 2);

		DataObject purchaseOrder = DataFactory.INSTANCE.create(
				SDO_MODEL_NAMESPACE,
"PurchaseOrderType");

		purchaseOrder.setString("orderDate", "1999-10-20");

		DataObject shipTo =
purchaseOrder.createDataObject("shipTo");
		shipTo.set("country", "US");
		shipTo.set("name", "Alice Smith");
		shipTo.set("street", "123 Maple Street");
		shipTo.set("city", "Mill Valley");
		shipTo.set("state", "CA");
		shipTo.setString("zip", "90952");
		DataObject billTo =
purchaseOrder.createDataObject("billTo");
		billTo.set("country", "US");
		billTo.set("name", "Robert Smith");
		billTo.set("street", "8 Oak Avenue");
		billTo.set("city", "Mill Valley");
		billTo.set("state", "PA");
		billTo.setString("zip", "95819");
		purchaseOrder.set("comment", "Hurry, my lawn is going
wild!");

		DataObject items =
purchaseOrder.createDataObject("items");

		DataObject item1 = items.createDataObject("item");
		item1.set("partNum", "872-AA");
		item1.set("productName", "Lawnmower");
		item1.setInt("quantity", 1);
		item1.setString("USPrice", "148.95");
		item1.set("comment", "Confirm this is electric");

		DataObject item2 = items.createDataObject("item");
		item2.set("partNum", "926-AA");
		item2.set("productName", "Baby Monitor");
		item2.setInt("quantity", 1);
		item2.setString("USPrice", "39.98");
		item2.setString("shipDate", "1999-05-21");

		try {
			OutputStream stream = System.err;
			XMLHelper.INSTANCE.save(purchaseOrder,
SDO_MODEL_NAMESPACE,
					"purchaseOrder", stream);
		} catch (IOException e) {
			e.printStackTrace();
			fail();
		}
	}

}

========================================================================
===========================
XML Schema Definition: po.xsd
========================================================================
===========================
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:po="http://www.example.com/PO"
targetNamespace="http://www.example.com/PO">

    <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
    <xsd:element name="comment" type="xsd:string"/>

    <xsd:complexType name="PurchaseOrderType">
        <xsd:sequence>
            <xsd:element name="shipTo" type="USAddress"/>
            <xsd:element name="billTo" type="USAddress"/>
            <xsd:element ref="po:comment" minOccurs="0"/>
            <xsd:element name="items"  type="Items"/>
        </xsd:sequence>
        <xsd:attribute name="orderDate" type="xsd:date"/>
    </xsd:complexType>

    <xsd:complexType name="USAddress">
        <xsd:sequence>
            <xsd:element name="name"   type="xsd:string"/>
            <xsd:element name="street" type="xsd:string"/>
            <xsd:element name="city"   type="xsd:string"/>
            <xsd:element name="state"  type="xsd:string"/>
            <xsd:element name="zip"    type="xsd:decimal"/>
        </xsd:sequence>
        <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
    </xsd:complexType>

    <xsd:complexType name="Items">
        <xsd:sequence>
            <xsd:element name="item" minOccurs="0"
maxOccurs="unbounded">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="productName"
type="xsd:string"/>
                        <xsd:element name="quantity">
                            <xsd:simpleType>
                                <xsd:restriction
base="xsd:positiveInteger">
                                    <xsd:maxExclusive value="100"/>
                                </xsd:restriction>
                            </xsd:simpleType>
                        </xsd:element>
                        <xsd:element name="USPrice"
type="xsd:decimal"/>
                        <xsd:element ref="po:comment"   minOccurs="0"/>
                        <xsd:element name="shipDate" type="xsd:date"
minOccurs="0"/>
                    </xsd:sequence>
                    <xsd:attribute name="partNum" type="po:SKU"
use="required"/>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:simpleType name="SKU">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="\d{3}-[A-Z]{2}"/>
        </xsd:restriction>
    </xsd:simpleType>
</xsd:schema>

Pinaki Poddar
972.834.2865

-----Original Message-----
From: kelvingoodson@gmail.com [mailto:kelvingoodson@gmail.com] On Behalf
Of kelvin goodson
Sent: Tuesday, July 03, 2007 3:43 AM
To: tuscany-dev@ws.apache.org
Subject: Re: How does one specify a Property as containment property in
XML Schema?

Hi Pinaki,
 I'm not sure if we are not understanding each other here,  or whether
technology is conspiring against us,  but what I'd like to do is to
execute the test code you are running myself, so please could you paste
the code of your test program.
Regards,Kelvin.


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

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


Re: How does one specify a Property as containment property in XML Schema?

Posted by kelvin goodson <ke...@thegoodsons.org.uk>.
Hi Pinaki,
 I'm not sure if we are not understanding each other here,  or whether
technology is conspiring against us,  but what I'd like to do is to execute
the test code you are running myself, so please could you paste the code of
your test program.
Regards,Kelvin.

On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
>
> Hello Kelvin,
>   I did it to 'tuscany-dev@ws.apache.org'. In case the mailserver is
> eating it up (our OpenJPA mailserver does), here it is again. Running
> TestSDO with po.xsd causes the following:
>
>
> java.lang.IllegalArgumentException: The property 'shipTo' of
> 'PurchaseOrderType' isn't a containment
>         at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> il.java:421)
>         at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> il.java:467)
>         at
> org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
> pl.java:1195)
>         at test.TestSDO.testCreateModel(TestSDO.java:57)
>
> Good news is I have continued with a workaround by constructing
> USAddress instances via DataFactory and setting that to PurchaseOrder
> property 'shipTo'/'billTo'. This does not imply containment but with
> that workaround I can proceed to persist a DataObject into a database
> via JPA. That is working.
>
>
> Pinaki Poddar
> 972.834.2865
>
> -----Original Message-----
> From: kelvin goodson [mailto:kelvingoodson@gmail.com]
> Sent: Tuesday, July 03, 2007 3:23 AM
> To: tuscany-dev@ws.apache.org
> Subject: Re: How does one specify a Property as containment property in
> XML Schema?
>
> Hi Pinaki,
>   can you please post your test code?
> Regards, Kelvin.
>
>
> On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
> >
> > Hi Fuhwei,
> >   The types are parsed and registered OK. The part of the test that
> > verfies it, passes alright. The test fails while the registered types
> > are used to create instances.
> >
> >   Please find attached JUnitTest, the XML Schema model and the stack
> > trace.
> >
> > java.lang.IllegalArgumentException: The property 'shipTo' of
> > 'PurchaseOrderType' isn't a containment
> >        at
> > org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObject
> > Ut
> > il.java:421)
> >        at
> > org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObject
> > Ut
> > il.java:467)
> >        at
> > org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObject
> > Im
> > pl.java:1195)
> >        at test.TestSDO.testCreateModel(TestSDO.java:57)
> >
> >
> >
> > Pinaki Poddar
> > 972.834.2865
> >
> > -----Original Message-----
> > From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com]
> > Sent: Monday, July 02, 2007 4:32 PM
> > To: tuscany-dev@ws.apache.org
> > Subject: RE: How does one specify a Property as containment property
> > in XML Schema?
> >
> > Hi Pinaki,
> >
> > I think your XSDHelper.define() failed to register types for some
> > reason. Can you try this to see whether any types were registered?
> >
> > java.util.List types = XSDHelper.INSTANCE.define(fis, null);
> >        for (int i=0; i<types.size(); i++) {
> >            System.out.println("Type defined: " + types.get(i));
> >        }
> >
> > Normally, you should see PurchaseOrderType, USAddress, etc registered.
> >
> > Fuhwei
> >
> > Pinaki Poddar <pp...@bea.com> wrote: Hello Fuhwei, I am following
> > your footstep! It is the same po.xsd I copied from your very readable
> > post
> >
> > http://www.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/
> > in
> > dex.html
> >
> > except that it was missing a closing
> >
> > Thanks for your help.
> >
> >
> > Pinaki Poddar
> > 972.834.2865
> >
> > -----Original Message-----
> > From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com]
> > Sent: Monday, July 02, 2007 3:35 PM
> > To: tuscany-dev@ws.apache.org
> > Subject: Re: How does one specify a Property as containment property
> > in XML Schema?
> >
> > Hi Pinaki,
> >
> > What is the type of "shipTo" property? It needs to be a complex type.
> > Can you post your XSD? Thanks.
> >
> > Fuhwei
> >
> >
> > Pinaki Poddar
> > wrote: Hello,
> >
> > How does one specify a Property as containment property in XML Schema?
> >
> >
> > I was trying a simple example with a XML Schema (po.xsd) that had the
> > following snippet:
> >
> >
> >
> >
> >
> > XSDHelper.INSTANCE.define(...) works fine to construct the types from
> > po.xsd.
> >
> > However when the following is executed:
> >
> > 01: DataObject purchaseOrder =
> > DataFactory.INSTANCE.create("http://www.example.com/PO",
> > "PurchaseOrderType");
> > 02: DataObject shipTo = purchaseOrder.createDataObject("shipTo");
> >
> > It fails with
> > java.lang.IllegalArgumentException: The property 'shipTo' of
> > 'PurchaseOrderType' isn't a containment  at
> > org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObject
> > Ut
> > il.java:421)
> > at
> > org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObject
> > Ut
> > il.java:467)
> > at
> > org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObject
> > Im
> > pl.java:1195)
> > at test.TestModel.testInstance(TestModel.java:41)
> >
> > I am using tuscany-sdo-impl-1.0-incubating-beta1.jar.
> >
> >
> > Pinaki Poddar
> > 972.834.2865
> >
> >
> > Notice:  This email message, together with any attachments, may
> > contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > affiliated entities,  that may be confidential,  proprietary,
> > copyrighted  and/or legally privileged, and is intended solely for the
>
> > use of the individual or entity named in this message. If you are not
> > the intended recipient, and have received this message in error,
> > please immediately return this by email and then delete it.
> >
> > Notice:  This email message, together with any attachments, may
> > contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > affiliated entities,  that may be confidential,  proprietary,
> > copyrighted  and/or legally privileged, and is intended solely for the
>
> > use of the individual or entity named in this message. If you are not
> > the intended recipient, and have received this message in error,
> > please immediately return this by email and then delete it.
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
> >
> > Notice:  This email message, together with any attachments, may
> > contain information  of  BEA Systems,  Inc.,  its subsidiaries  and
> > affiliated entities,  that may be confidential,  proprietary,
> > copyrighted  and/or legally privileged, and is intended solely for the
>
> > use of the individual or entity named in this message. If you are not
> > the intended recipient, and have received this message in error,
> > please immediately return this by email and then delete it.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
>
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual or
> entity named in this message. If you are not the intended recipient, and
> have received this message in error, please immediately return this by email
> and then delete it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>

RE: How does one specify a Property as containment property in XML Schema?

Posted by Pinaki Poddar <pp...@bea.com>.
Hello Kelvin,
  I did it to 'tuscany-dev@ws.apache.org'. In case the mailserver is
eating it up (our OpenJPA mailserver does), here it is again. Running
TestSDO with po.xsd causes the following:
  

java.lang.IllegalArgumentException: The property 'shipTo' of
'PurchaseOrderType' isn't a containment
	at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:421)
	at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:467)
	at
org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
pl.java:1195)
	at test.TestSDO.testCreateModel(TestSDO.java:57)

Good news is I have continued with a workaround by constructing
USAddress instances via DataFactory and setting that to PurchaseOrder
property 'shipTo'/'billTo'. This does not imply containment but with
that workaround I can proceed to persist a DataObject into a database
via JPA. That is working.


Pinaki Poddar
972.834.2865

-----Original Message-----
From: kelvin goodson [mailto:kelvingoodson@gmail.com] 
Sent: Tuesday, July 03, 2007 3:23 AM
To: tuscany-dev@ws.apache.org
Subject: Re: How does one specify a Property as containment property in
XML Schema?

Hi Pinaki,
  can you please post your test code?
Regards, Kelvin.


On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
>
> Hi Fuhwei,
>   The types are parsed and registered OK. The part of the test that 
> verfies it, passes alright. The test fails while the registered types 
> are used to create instances.
>
>   Please find attached JUnitTest, the XML Schema model and the stack 
> trace.
>
> java.lang.IllegalArgumentException: The property 'shipTo' of 
> 'PurchaseOrderType' isn't a containment
>        at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObject
> Ut
> il.java:421)
>        at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObject
> Ut
> il.java:467)
>        at
> org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObject
> Im
> pl.java:1195)
>        at test.TestSDO.testCreateModel(TestSDO.java:57)
>
>
>
> Pinaki Poddar
> 972.834.2865
>
> -----Original Message-----
> From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com]
> Sent: Monday, July 02, 2007 4:32 PM
> To: tuscany-dev@ws.apache.org
> Subject: RE: How does one specify a Property as containment property 
> in XML Schema?
>
> Hi Pinaki,
>
> I think your XSDHelper.define() failed to register types for some 
> reason. Can you try this to see whether any types were registered?
>
> java.util.List types = XSDHelper.INSTANCE.define(fis, null);
>        for (int i=0; i<types.size(); i++) {
>            System.out.println("Type defined: " + types.get(i));
>        }
>
> Normally, you should see PurchaseOrderType, USAddress, etc registered.
>
> Fuhwei
>
> Pinaki Poddar <pp...@bea.com> wrote: Hello Fuhwei, I am following 
> your footstep! It is the same po.xsd I copied from your very readable 
> post
>
> http://www.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/
> in
> dex.html
>
> except that it was missing a closing
>
> Thanks for your help.
>
>
> Pinaki Poddar
> 972.834.2865
>
> -----Original Message-----
> From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com]
> Sent: Monday, July 02, 2007 3:35 PM
> To: tuscany-dev@ws.apache.org
> Subject: Re: How does one specify a Property as containment property 
> in XML Schema?
>
> Hi Pinaki,
>
> What is the type of "shipTo" property? It needs to be a complex type.
> Can you post your XSD? Thanks.
>
> Fuhwei
>
>
> Pinaki Poddar
> wrote: Hello,
>
> How does one specify a Property as containment property in XML Schema?
>
>
> I was trying a simple example with a XML Schema (po.xsd) that had the 
> following snippet:
>
>
>
>
>
> XSDHelper.INSTANCE.define(...) works fine to construct the types from 
> po.xsd.
>
> However when the following is executed:
>
> 01: DataObject purchaseOrder =
> DataFactory.INSTANCE.create("http://www.example.com/PO",
> "PurchaseOrderType");
> 02: DataObject shipTo = purchaseOrder.createDataObject("shipTo");
>
> It fails with
> java.lang.IllegalArgumentException: The property 'shipTo' of 
> 'PurchaseOrderType' isn't a containment  at 
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObject
> Ut
> il.java:421)
> at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObject
> Ut
> il.java:467)
> at
> org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObject
> Im
> pl.java:1195)
> at test.TestModel.testInstance(TestModel.java:41)
>
> I am using tuscany-sdo-impl-1.0-incubating-beta1.jar.
>
>
> Pinaki Poddar
> 972.834.2865
>
>
> Notice:  This email message, together with any attachments, may 
> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  
> affiliated entities,  that may be confidential,  proprietary,  
> copyrighted  and/or legally privileged, and is intended solely for the

> use of the individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in error, 
> please immediately return this by email and then delete it.
>
> Notice:  This email message, together with any attachments, may 
> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  
> affiliated entities,  that may be confidential,  proprietary,  
> copyrighted  and/or legally privileged, and is intended solely for the

> use of the individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in error, 
> please immediately return this by email and then delete it.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>
> Notice:  This email message, together with any attachments, may 
> contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  
> affiliated entities,  that may be confidential,  proprietary,  
> copyrighted  and/or legally privileged, and is intended solely for the

> use of the individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in error, 
> please immediately return this by email and then delete it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

Re: How does one specify a Property as containment property in XML Schema?

Posted by kelvin goodson <ke...@gmail.com>.
Hi Pinaki,
 I meant to say please "paste" your test code,  as attachments get stripped
from this list.
Regards,Kelvin.


On 03/07/07, kelvin goodson <ke...@gmail.com> wrote:
>
> Hi Pinaki,
>   can you please post your test code?
> Regards, Kelvin.
>
>
>  On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
> >
> > Hi Fuhwei,
> >   The types are parsed and registered OK. The part of the test that
> > verfies it, passes alright. The test fails while the registered types
> > are used to create instances.
> >
> >   Please find attached JUnitTest, the XML Schema model and the stack
> > trace.
> >
> > java.lang.IllegalArgumentException: The property 'shipTo' of
> > 'PurchaseOrderType' isn't a containment
> >        at
> > org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> > il.java:421)
> >        at
> > org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> > il.java:467)
> >        at
> > org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
> > pl.java:1195)
> >        at test.TestSDO.testCreateModel(TestSDO.java:57)
> >
> >
> >
> > Pinaki Poddar
> > 972.834.2865
> >
> > -----Original Message-----
> > From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com]
> > Sent: Monday, July 02, 2007 4:32 PM
> > To: tuscany-dev@ws.apache.org
> > Subject: RE: How does one specify a Property as containment property in
> > XML Schema?
> >
> > Hi Pinaki,
> >
> > I think your XSDHelper.define() failed to register types for some
> > reason. Can you try this to see whether any types were registered?
> >
> > java.util.List types = XSDHelper.INSTANCE.define (fis, null);
> >        for (int i=0; i<types.size(); i++) {
> >            System.out.println("Type defined: " + types.get(i));
> >        }
> >
> > Normally, you should see PurchaseOrderType, USAddress, etc registered.
> >
> > Fuhwei
> >
> > Pinaki Poddar <pp...@bea.com> wrote: Hello Fuhwei,
> > I am following your footstep! It is the same po.xsd I copied from your
> > very readable post
> >
> > http://www.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/in
> > dex.html
> >
> > except that it was missing a closing
> >
> > Thanks for your help.
> >
> >
> > Pinaki Poddar
> > 972.834.2865
> >
> > -----Original Message-----
> > From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com]
> > Sent: Monday, July 02, 2007 3:35 PM
> > To: tuscany-dev@ws.apache.org
> > Subject: Re: How does one specify a Property as containment property in
> > XML Schema?
> >
> > Hi Pinaki,
> >
> > What is the type of "shipTo" property? It needs to be a complex type.
> > Can you post your XSD? Thanks.
> >
> > Fuhwei
> >
> >
> > Pinaki Poddar
> > wrote: Hello,
> >
> > How does one specify a Property as containment property in XML Schema?
> >
> >
> > I was trying a simple example with a XML Schema ( po.xsd) that had the
> > following snippet:
> >
> >
> >
> >
> >
> > XSDHelper.INSTANCE.define(...) works fine to construct the types from
> > po.xsd.
> >
> > However when the following is executed:
> >
> > 01: DataObject purchaseOrder =
> > DataFactory.INSTANCE.create("http://www.example.com/PO",
> > "PurchaseOrderType");
> > 02: DataObject shipTo = purchaseOrder.createDataObject("shipTo");
> >
> > It fails with
> > java.lang.IllegalArgumentException: The property 'shipTo' of
> > 'PurchaseOrderType' isn't a containment  at
> > org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> >
> > il.java:421)
> > at
> > org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> > il.java:467)
> > at
> > org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
> > pl.java:1195)
> > at test.TestModel.testInstance (TestModel.java:41)
> >
> > I am using tuscany-sdo-impl-1.0-incubating-beta1.jar.
> >
> >
> > Pinaki Poddar
> > 972.834.2865
> >
> >
> > Notice:  This email message, together with any attachments, may contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> > entities,  that may be confidential,  proprietary,  copyrighted  and/or
> > legally privileged, and is intended solely for the use of the individual
> > or entity named in this message. If you are not the intended recipient,
> > and have received this message in error, please immediately return this
> > by email and then delete it.
> >
> > Notice:  This email message, together with any attachments, may contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> > entities,  that may be confidential,  proprietary,  copyrighted  and/or
> > legally privileged, and is intended solely for the use of the individual
> > or entity named in this message. If you are not the intended recipient,
> > and have received this message in error, please immediately return this
> > by email and then delete it.
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
> >
> > Notice:  This email message, together with any attachments, may contain
> > information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> > entities,  that may be confidential,  proprietary,  copyrighted  and/or
> > legally privileged, and is intended solely for the use of the individual or
> > entity named in this message. If you are not the intended recipient, and
> > have received this message in error, please immediately return this by email
> > and then delete it.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
>
>

Re: How does one specify a Property as containment property in XML Schema?

Posted by kelvin goodson <ke...@gmail.com>.
Hi Pinaki,
  can you please post your test code?
Regards, Kelvin.


On 03/07/07, Pinaki Poddar <pp...@bea.com> wrote:
>
> Hi Fuhwei,
>   The types are parsed and registered OK. The part of the test that
> verfies it, passes alright. The test fails while the registered types
> are used to create instances.
>
>   Please find attached JUnitTest, the XML Schema model and the stack
> trace.
>
> java.lang.IllegalArgumentException: The property 'shipTo' of
> 'PurchaseOrderType' isn't a containment
>        at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> il.java:421)
>        at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> il.java:467)
>        at
> org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
> pl.java:1195)
>        at test.TestSDO.testCreateModel(TestSDO.java:57)
>
>
>
> Pinaki Poddar
> 972.834.2865
>
> -----Original Message-----
> From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com]
> Sent: Monday, July 02, 2007 4:32 PM
> To: tuscany-dev@ws.apache.org
> Subject: RE: How does one specify a Property as containment property in
> XML Schema?
>
> Hi Pinaki,
>
> I think your XSDHelper.define() failed to register types for some
> reason. Can you try this to see whether any types were registered?
>
> java.util.List types = XSDHelper.INSTANCE.define(fis, null);
>        for (int i=0; i<types.size(); i++) {
>            System.out.println("Type defined: " + types.get(i));
>        }
>
> Normally, you should see PurchaseOrderType, USAddress, etc registered.
>
> Fuhwei
>
> Pinaki Poddar <pp...@bea.com> wrote: Hello Fuhwei,
> I am following your footstep! It is the same po.xsd I copied from your
> very readable post
>
> http://www.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/in
> dex.html
>
> except that it was missing a closing
>
> Thanks for your help.
>
>
> Pinaki Poddar
> 972.834.2865
>
> -----Original Message-----
> From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com]
> Sent: Monday, July 02, 2007 3:35 PM
> To: tuscany-dev@ws.apache.org
> Subject: Re: How does one specify a Property as containment property in
> XML Schema?
>
> Hi Pinaki,
>
> What is the type of "shipTo" property? It needs to be a complex type.
> Can you post your XSD? Thanks.
>
> Fuhwei
>
>
> Pinaki Poddar
> wrote: Hello,
>
> How does one specify a Property as containment property in XML Schema?
>
>
> I was trying a simple example with a XML Schema (po.xsd) that had the
> following snippet:
>
>
>
>
>
> XSDHelper.INSTANCE.define(...) works fine to construct the types from
> po.xsd.
>
> However when the following is executed:
>
> 01: DataObject purchaseOrder =
> DataFactory.INSTANCE.create("http://www.example.com/PO",
> "PurchaseOrderType");
> 02: DataObject shipTo = purchaseOrder.createDataObject("shipTo");
>
> It fails with
> java.lang.IllegalArgumentException: The property 'shipTo' of
> 'PurchaseOrderType' isn't a containment  at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> il.java:421)
> at
> org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
> il.java:467)
> at
> org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
> pl.java:1195)
> at test.TestModel.testInstance(TestModel.java:41)
>
> I am using tuscany-sdo-impl-1.0-incubating-beta1.jar.
>
>
> Pinaki Poddar
> 972.834.2865
>
>
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
>
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual
> or entity named in this message. If you are not the intended recipient,
> and have received this message in error, please immediately return this
> by email and then delete it.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>
> Notice:  This email message, together with any attachments, may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
> entities,  that may be confidential,  proprietary,  copyrighted  and/or
> legally privileged, and is intended solely for the use of the individual or
> entity named in this message. If you are not the intended recipient, and
> have received this message in error, please immediately return this by email
> and then delete it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>

RE: How does one specify a Property as containment property in XML Schema?

Posted by Pinaki Poddar <pp...@bea.com>.
Hi Fuhwei,
   The types are parsed and registered OK. The part of the test that
verfies it, passes alright. The test fails while the registered types
are used to create instances.    

   Please find attached JUnitTest, the XML Schema model and the stack
trace.

 java.lang.IllegalArgumentException: The property 'shipTo' of
'PurchaseOrderType' isn't a containment
	at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:421)
	at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:467)
	at
org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
pl.java:1195)
	at test.TestSDO.testCreateModel(TestSDO.java:57)



Pinaki Poddar
972.834.2865

-----Original Message-----
From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com] 
Sent: Monday, July 02, 2007 4:32 PM
To: tuscany-dev@ws.apache.org
Subject: RE: How does one specify a Property as containment property in
XML Schema? 

Hi Pinaki,

I think your XSDHelper.define() failed to register types for some
reason. Can you try this to see whether any types were registered?

java.util.List types = XSDHelper.INSTANCE.define(fis, null);
        for (int i=0; i<types.size(); i++) {
            System.out.println("Type defined: " + types.get(i));
        }

Normally, you should see PurchaseOrderType, USAddress, etc registered.

Fuhwei

Pinaki Poddar <pp...@bea.com> wrote: Hello Fuhwei,
  I am following your footstep! It is the same po.xsd I copied from your
very readable post
 
http://www.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/in
dex.html

  except that it was missing a closing 

  Thanks for your help.


Pinaki Poddar
972.834.2865

-----Original Message-----
From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com]
Sent: Monday, July 02, 2007 3:35 PM
To: tuscany-dev@ws.apache.org
Subject: Re: How does one specify a Property as containment property in
XML Schema? 

Hi Pinaki,

What is the type of "shipTo" property? It needs to be a complex type.
Can you post your XSD? Thanks.

Fuhwei


Pinaki Poddar
 wrote: Hello,

  How does one specify a Property as containment property in XML Schema?


  I was trying a simple example with a XML Schema (po.xsd) that had the
following snippet:

    
        
            

  XSDHelper.INSTANCE.define(...) works fine to construct the types from
po.xsd.

  However when the following is executed:

 01: DataObject purchaseOrder =
DataFactory.INSTANCE.create("http://www.example.com/PO",
"PurchaseOrderType");
 02: DataObject shipTo = purchaseOrder.createDataObject("shipTo");

It fails with
java.lang.IllegalArgumentException: The property 'shipTo' of
'PurchaseOrderType' isn't a containment  at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:421)
 at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:467)
 at
org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
pl.java:1195)
 at test.TestModel.testInstance(TestModel.java:41)

  I am using tuscany-sdo-impl-1.0-incubating-beta1.jar.


Pinaki Poddar
972.834.2865


Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

RE: How does one specify a Property as containment property in XML Schema?

Posted by Fuhwei Lwo <fu...@bricemedia.com>.
Hi Pinaki,

I think your XSDHelper.define() failed to register types for some reason. Can you try this to see whether any types were registered?

java.util.List types = XSDHelper.INSTANCE.define(fis, null);
        for (int i=0; i<types.size(); i++) {
            System.out.println("Type defined: " + types.get(i));
        }

Normally, you should see PurchaseOrderType, USAddress, etc registered.

Fuhwei

Pinaki Poddar <pp...@bea.com> wrote: Hello Fuhwei,
  I am following your footstep! It is the same po.xsd I copied from your
very readable post
 
http://www.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/in
dex.html

  except that it was missing a closing 

  Thanks for your help.


Pinaki Poddar
972.834.2865

-----Original Message-----
From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com] 
Sent: Monday, July 02, 2007 3:35 PM
To: tuscany-dev@ws.apache.org
Subject: Re: How does one specify a Property as containment property in
XML Schema? 

Hi Pinaki,

What is the type of "shipTo" property? It needs to be a complex type.
Can you post your XSD? Thanks.

Fuhwei


Pinaki Poddar 
 wrote: Hello,

  How does one specify a Property as containment property in XML Schema?


  I was trying a simple example with a XML Schema (po.xsd) that had the
following snippet:

    
        
            

  XSDHelper.INSTANCE.define(...) works fine to construct the types from
po.xsd.

  However when the following is executed:

 01: DataObject purchaseOrder =
DataFactory.INSTANCE.create("http://www.example.com/PO",
"PurchaseOrderType");
 02: DataObject shipTo = purchaseOrder.createDataObject("shipTo");

It fails with
java.lang.IllegalArgumentException: The property 'shipTo' of
'PurchaseOrderType' isn't a containment  at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:421)
 at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:467)
 at
org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
pl.java:1195)
 at test.TestModel.testInstance(TestModel.java:41)

  I am using tuscany-sdo-impl-1.0-incubating-beta1.jar.


Pinaki Poddar
972.834.2865


Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


RE: How does one specify a Property as containment property in XML Schema?

Posted by Pinaki Poddar <pp...@bea.com>.
Hello Fuhwei,
  I am following your footstep! It is the same po.xsd I copied from your
very readable post
 
http://www.ibm.com/developerworks/webservices/library/ws-sdoxmlschema/in
dex.html

  except that it was missing a closing </xsd:schema>

  Thanks for your help.


Pinaki Poddar
972.834.2865

-----Original Message-----
From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com] 
Sent: Monday, July 02, 2007 3:35 PM
To: tuscany-dev@ws.apache.org
Subject: Re: How does one specify a Property as containment property in
XML Schema? 

Hi Pinaki,

What is the type of "shipTo" property? It needs to be a complex type.
Can you post your XSD? Thanks.

Fuhwei


Pinaki Poddar <pp...@bea.com> wrote: Hello,

  How does one specify a Property as containment property in XML Schema?


  I was trying a simple example with a XML Schema (po.xsd) that had the
following snippet:

    
        
            

  XSDHelper.INSTANCE.define(...) works fine to construct the types from
po.xsd.

  However when the following is executed:

 01: DataObject purchaseOrder =
DataFactory.INSTANCE.create("http://www.example.com/PO",
"PurchaseOrderType");
 02: DataObject shipTo = purchaseOrder.createDataObject("shipTo");

It fails with
java.lang.IllegalArgumentException: The property 'shipTo' of
'PurchaseOrderType' isn't a containment  at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:421)
 at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:467)
 at
org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
pl.java:1195)
 at test.TestModel.testInstance(TestModel.java:41)

  I am using tuscany-sdo-impl-1.0-incubating-beta1.jar.


Pinaki Poddar
972.834.2865


Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

Re: How does one specify a Property as containment property in XML Schema?

Posted by Fuhwei Lwo <fu...@bricemedia.com>.
Hi Pinaki,

What is the type of "shipTo" property? It needs to be a complex type. Can you post your XSD? Thanks.

Fuhwei


Pinaki Poddar <pp...@bea.com> wrote: Hello,

  How does one specify a Property as containment property in XML Schema?


  I was trying a simple example with a XML Schema (po.xsd) that had the
following snippet:

    
        
            

  XSDHelper.INSTANCE.define(...) works fine to construct the types from
po.xsd.

  However when the following is executed:

 01: DataObject purchaseOrder =
DataFactory.INSTANCE.create("http://www.example.com/PO",
"PurchaseOrderType");
 02: DataObject shipTo = purchaseOrder.createDataObject("shipTo");

It fails with 
java.lang.IllegalArgumentException: The property 'shipTo' of
'PurchaseOrderType' isn't a containment
 at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:421)
 at
org.apache.tuscany.sdo.util.DataObjectUtil.createDataObject(DataObjectUt
il.java:467)
 at
org.apache.tuscany.sdo.impl.DataObjectImpl.createDataObject(DataObjectIm
pl.java:1195)
 at test.TestModel.testInstance(TestModel.java:41)

  I am using tuscany-sdo-impl-1.0-incubating-beta1.jar.


Pinaki Poddar
972.834.2865


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.