You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by qi chi <qi...@yahoo.com.cn> on 2007/07/05 11:25:58 UTC

A question on SDO 2.0

Dear all,
   
  We are using tuscany SDO implementation. There is a problem that we can not resolve. Would you please kindly give some hints.
   
  We hava schema 
   
  <?xml version="1.0" encoding="UTF-8"?>
  <schema targetNamespace="http://stf.ibm.com/Computer"
      elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"
      xmlns:tns="http://stf.ibm.com/Computer">
   
  
      <complexType name="Computer">
          <sequence>
              <element name="type" type="string"></element>
              <element name="price" type="string"></element>
          </sequence>
      </complexType>
   
  
      <element name="computer" type="tns:Computer"></element>
   
  
  </schema>
   
  We use XSD2JavaGenerator and get a interface "Computer" and class "ComputerImpl". How can we load a XML and get a "ComputerImpl" instance? Currently, we can only load a XML as a DataObject. And we can not find a way to cast the DataObject to the "ComputerImpl" Java Object.

 		
---------------------------------
 雅虎免费邮箱-3.5G容量,20M附件

Re: A question on SDO 2.0

Posted by Frank Budinsky <fr...@ca.ibm.com>.
You should be able to cast the DataObject to the Computer interface. If 
you can't my guess is that you didn't register the metadata, by calling 
the generated Factory.register() method, before loading the XML.

Frank.

qi chi <qi...@yahoo.com.cn> wrote on 07/05/2007 05:25:58 AM:

> Dear all,
> 
>   We are using tuscany SDO implementation. There is a problem that 
> we can not resolve. Would you please kindly give some hints.
> 
>   We hava schema 
> 
>   <?xml version="1.0" encoding="UTF-8"?>
>   <schema targetNamespace="http://stf.ibm.com/Computer"
>       elementFormDefault="qualified" 
xmlns="http://www.w3.org/2001/XMLSchema"
>       xmlns:tns="http://stf.ibm.com/Computer">
> 
> 
>       <complexType name="Computer">
>           <sequence>
>               <element name="type" type="string"></element>
>               <element name="price" type="string"></element>
>           </sequence>
>       </complexType>
> 
> 
>       <element name="computer" type="tns:Computer"></element>
> 
> 
>   </schema>
> 
>   We use XSD2JavaGenerator and get a interface "Computer" and class 
> "ComputerImpl". How can we load a XML and get a "ComputerImpl" 
> instance? Currently, we can only load a XML as a DataObject. And we 
> can not find a way to cast the DataObject to the "ComputerImpl" Java 
Object.
> 
> 
> ---------------------------------
>  雅虎免费邮箱-3.5G容量,20M附件