You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Christian Landbo Frederiksen <Ch...@ementor.dk> on 2007/01/29 23:27:08 UTC

Root property that is not containment

Hi
 
I have just started using this SDO-thing and I am very excited about it.
I am using it to analyse xml-schemas and to generate and accept data for
the given schemas.
 
I have run into something (again). Lets say I am given a simple schema
such as this:  
 
<?xml version="1.0" encoding="utf-8"?>
<schema xmlns:test="testns" xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="testns">
  <element name="Test" type="test:TestType"/>
  <simpleType name="TestType">
    <restriction base="decimal">
      <minInclusive value="0"/>
      <maxInclusive value="13"/>
    </restriction>
  </simpleType>
</schema>

When analysing this I cannot generate a DataObject for the Test-property
because it is not a containment property.
So I figured I could just use the 'DocumentRoot' DataObject, but this
gives me XML like this, which is not valid:

<?xml version="1.0" encoding="ASCII"?>
<_20:DocumentRoot
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:_20="testns"
xsi:type="_20"><_20:Test>1</_20:Test></_20:DocumentRoot>

But what I wanted was something valid like this :

<?xml version="1.0" encoding="UTF-8"?>
<Test xmlns="testns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">3.1415926535897932
384626433832795</Test>

Am I missing something? What would be an appropiate way to deal with
root-properties that are not containment properties?

/Chr

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


Re: Root property that is not containment

Posted by Yang ZHONG <le...@gmail.com>.
DataObject is a complexType. To use DataObject with a
simpleType("TestType"), a wrapper may be required.

If interested, below XML(<Test...) can be loaded and a wrapper may be
observed.


On 1/29/07, Christian Landbo Frederiksen <
Christian.Landbo.Frederiksen@ementor.dk> wrote:
>
> Hi
>
> I have just started using this SDO-thing and I am very excited about it.
> I am using it to analyse xml-schemas and to generate and accept data for
> the given schemas.
>
> I have run into something (again). Lets say I am given a simple schema
> such as this:
>
> <?xml version="1.0" encoding="utf-8"?>
> <schema xmlns:test="testns" xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="testns">
> <element name="Test" type="test:TestType"/>
> <simpleType name="TestType">
>    <restriction base="decimal">
>      <minInclusive value="0"/>
>      <maxInclusive value="13"/>
>    </restriction>
> </simpleType>
> </schema>
>
> When analysing this I cannot generate a DataObject for the Test-property
> because it is not a containment property.
> So I figured I could just use the 'DocumentRoot' DataObject, but this
> gives me XML like this, which is not valid:
>
> <?xml version="1.0" encoding="ASCII"?>
> <_20:DocumentRoot
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:_20="testns"
> xsi:type="_20"><_20:Test>1</_20:Test></_20:DocumentRoot>
>
> But what I wanted was something valid like this :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Test xmlns="testns"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">3.1415926535897932
> 384626433832795</Test>
>
> Am I missing something? What would be an appropiate way to deal with
> root-properties that are not containment properties?
>
> /Chr
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>


-- 

Yang ZHONG

RE: Root property that is not containment

Posted by Frank Budinsky <fr...@ca.ibm.com>.
The type needed as param for SDAOUtil.createDataTypeWrapper() is the 
simple type you want to set ("testns#TestType" in your example below). You 
can get it using typeHelper.getType("testns", "TestType").

SDOUtil.createDataTypeWrapper() will create a DataObject that wraps the 
requested data type value. SimpleAnyTypeDataObjectImpl is the Tuscany 
implementation class of the wrapper object.

Frank.


"Christian Landbo Frederiksen" <CL...@Ementor.dk> wrote on 04/03/2007 
08:43:01 AM:

> Hi
> 
> I know this thread is OLD, but I have been forced to look at this again
> (I thought I could ignore simple typed roots).
> 
> I hope some of you can remember when you read it again :)
> 
> My question is: how do you create the type needed as param for the
> SDOUtil.createDataTypeWrapper() method. I have seen the getXSDSDOType
> method but how do I find out what the simple type is, that is defined.
> 
> I tried to do a load and it just resulted in a
> SimpleAnyTypeDataObjectImpl.
> 
> Have you got any axamples using SDOUtil.createDataTypeWrapper()?
> 
> /Chr
> 
> -----Original Message-----
> From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
> Sent: 30. januar 2007 02:12
> To: tuscany-user@ws.apache.org
> Subject: Re: Root property that is not containment
> 
> Hi Cristian,
> 
> To create a document with a root element that is a simple type (DataType
> 
> as opposed to DataObject) you need a wrapper DataObject. You can call 
> SDOUtil.createDataTypeWrapper() to get one.
> 
> Frank.
> 
> "Christian Landbo Frederiksen" <Ch...@ementor.dk>
> 
> wrote on 01/29/2007 05:27:08 PM:
> 
> > Hi
> > 
> > I have just started using this SDO-thing and I am very excited about
> it.
> > I am using it to analyse xml-schemas and to generate and accept data
> for
> > the given schemas.
> > 
> > I have run into something (again). Lets say I am given a simple schema
> > such as this: 
> > 
> > <?xml version="1.0" encoding="utf-8"?>
> > <schema xmlns:test="testns" xmlns="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="testns">
> >   <element name="Test" type="test:TestType"/>
> >   <simpleType name="TestType">
> >     <restriction base="decimal">
> >       <minInclusive value="0"/>
> >       <maxInclusive value="13"/>
> >     </restriction>
> >   </simpleType>
> > </schema>
> > 
> > When analysing this I cannot generate a DataObject for the
> Test-property
> > because it is not a containment property.
> > So I figured I could just use the 'DocumentRoot' DataObject, but this
> > gives me XML like this, which is not valid:
> > 
> > <?xml version="1.0" encoding="ASCII"?>
> > <_20:DocumentRoot
> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:_20="testns"
> > xsi:type="_20"><_20:Test>1</_20:Test></_20:DocumentRoot>
> > 
> > But what I wanted was something valid like this :
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <Test xmlns="testns"
> >
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">3.1415926535897932
> > 384626433832795</Test>
> > 
> > Am I missing something? What would be an appropiate way to deal with
> > root-properties that are not containment properties?
> > 
> > /Chr
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-user-help@ws.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


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


RE: Root property that is not containment

Posted by Christian Landbo Frederiksen <CL...@Ementor.dk>.
Hi

I know this thread is OLD, but I have been forced to look at this again
(I thought I could ignore simple typed roots).

I hope some of you can remember when you read it again :)

My question is: how do you create the type needed as param for the
SDOUtil.createDataTypeWrapper() method. I have seen the getXSDSDOType
method but how do I find out what the simple type is, that is defined.

I tried to do a load and it just resulted in a
SimpleAnyTypeDataObjectImpl.

Have you got any axamples using SDOUtil.createDataTypeWrapper()?

/Chr

-----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
Sent: 30. januar 2007 02:12
To: tuscany-user@ws.apache.org
Subject: Re: Root property that is not containment

Hi Cristian,

To create a document with a root element that is a simple type (DataType

as opposed to DataObject) you need a wrapper DataObject. You can call 
SDOUtil.createDataTypeWrapper() to get one.

Frank.

"Christian Landbo Frederiksen" <Ch...@ementor.dk>

wrote on 01/29/2007 05:27:08 PM:

> Hi
> 
> I have just started using this SDO-thing and I am very excited about
it.
> I am using it to analyse xml-schemas and to generate and accept data
for
> the given schemas.
> 
> I have run into something (again). Lets say I am given a simple schema
> such as this: 
> 
> <?xml version="1.0" encoding="utf-8"?>
> <schema xmlns:test="testns" xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="testns">
>   <element name="Test" type="test:TestType"/>
>   <simpleType name="TestType">
>     <restriction base="decimal">
>       <minInclusive value="0"/>
>       <maxInclusive value="13"/>
>     </restriction>
>   </simpleType>
> </schema>
> 
> When analysing this I cannot generate a DataObject for the
Test-property
> because it is not a containment property.
> So I figured I could just use the 'DocumentRoot' DataObject, but this
> gives me XML like this, which is not valid:
> 
> <?xml version="1.0" encoding="ASCII"?>
> <_20:DocumentRoot
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:_20="testns"
> xsi:type="_20"><_20:Test>1</_20:Test></_20:DocumentRoot>
> 
> But what I wanted was something valid like this :
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Test xmlns="testns"
>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">3.1415926535897932
> 384626433832795</Test>
> 
> Am I missing something? What would be an appropiate way to deal with
> root-properties that are not containment properties?
> 
> /Chr
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


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



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


Re: Root property that is not containment

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi Cristian,

To create a document with a root element that is a simple type (DataType 
as opposed to DataObject) you need a wrapper DataObject. You can call 
SDOUtil.createDataTypeWrapper() to get one.

Frank.

"Christian Landbo Frederiksen" <Ch...@ementor.dk> 
wrote on 01/29/2007 05:27:08 PM:

> Hi
> 
> I have just started using this SDO-thing and I am very excited about it.
> I am using it to analyse xml-schemas and to generate and accept data for
> the given schemas.
> 
> I have run into something (again). Lets say I am given a simple schema
> such as this: 
> 
> <?xml version="1.0" encoding="utf-8"?>
> <schema xmlns:test="testns" xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="testns">
>   <element name="Test" type="test:TestType"/>
>   <simpleType name="TestType">
>     <restriction base="decimal">
>       <minInclusive value="0"/>
>       <maxInclusive value="13"/>
>     </restriction>
>   </simpleType>
> </schema>
> 
> When analysing this I cannot generate a DataObject for the Test-property
> because it is not a containment property.
> So I figured I could just use the 'DocumentRoot' DataObject, but this
> gives me XML like this, which is not valid:
> 
> <?xml version="1.0" encoding="ASCII"?>
> <_20:DocumentRoot
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:_20="testns"
> xsi:type="_20"><_20:Test>1</_20:Test></_20:DocumentRoot>
> 
> But what I wanted was something valid like this :
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Test xmlns="testns"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">3.1415926535897932
> 384626433832795</Test>
> 
> Am I missing something? What would be an appropiate way to deal with
> root-properties that are not containment properties?
> 
> /Chr
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


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