You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Prashanth Rao <pr...@gmail.com> on 2008/04/22 11:59:02 UTC

SDO and Complex Content / extension base not working

 Hi

Can you help me in resoving a issue i am facing with SDO C++ implementation.

1. I have 2 xsd's and I am loading the main XSD (Audit) along with the xml
in the SDO C++ program
2. However, when the xml load is done (using xmlhelper) I dont see the data
for "AuditTable" element , I see the data only for "AuditID" element

3. When i change the type for "AuditTable" element as below, The xml loading
happens
 <xs:element name="AuditTable" type="stype:ENUM" minOccurs="0"/>

4. What could be the reason for this behaviour? Is it that SDO C++ does not
support <complexContent>?
I have tried even changing that to <simpleContent> as well.. but still no
luck


Please help me out.




AUDIT.XSD
-------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:tns="http://www.xyz.com/cash" xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:stype="http://www.xyz.com/stype"
targetNamespace="http://www.xyz.com/cash" elementFormDefault="qualified">
 <xs:import namespace="http://www.xyz.com/stype"
schemaLocation="stype.xsd"/>
 <xs:element name="AUDIT">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="AuditId" type="stype:STRING" minOccurs="0"/>
    <xs:element name="AuditTable" type="tns:sTable" minOccurs="0"/>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
 <xs:complexType name="AuditTable">
   <xs:complexContent>
    <xs:extension base="stype:ENUM"/>
   </xs:complexContent>
 </xs:complexType>
</xs:schema>


----------------------------------------------------------------------------------------------

STYPE.XSD
--------------

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sutype="
http://www.xyz.com/stype" targetNamespace="http://www.xyz.com/stype"
elementFormDefault="qualified">
 <xs:complexType name="ENUM">
  <xs:simpleContent>
   <xs:extension base="xs:string">
    <xs:attribute name="TYPE" fixed="ENUM"/>
    <xs:attribute name="derived" use="optional"/>
    <xs:attribute name="readonly" use="optional"/>
    <xs:attribute name="required" use="optional"/>
   </xs:extension>
  </xs:simpleContent>
 </xs:complexType>
  <xs:complexType name="STRING">
   <xs:simpleContent>
    <xs:extension base="xs:string">
     <xs:attribute name="TYPE" use="optional"/>
     <xs:attribute name="derived" use="optional"/>
     <xs:attribute name="readonly" use="optional"/>
     <xs:attribute name="required" use="optional"/>
    </xs:extension>
   </xs:simpleContent>
 </xs:complexType>

---------------------------------------------------------------------------
AUDIT.XML

<?xml version="1.0" encoding="UTF-8"?>
<tns:AUDIT xsi:schemaLocation="http://www.xyz.com/cash AUDIT.xsd"
xmlns:tns="http://www.xyz.com/cash" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
 <tns:Audit_Id>AUDITID</tns:Audit_Id>
 <tns:Audit_Table>ABCD</tns:Audit_Table>
</tns:AUDIT>
-----------------------------------

Re: SDO and Complex Content / extension base not working

Posted by Simon Laws <si...@googlemail.com>.
On Tue, Apr 22, 2008 at 10:59 AM, Prashanth Rao <pr...@gmail.com>
wrote:

>  Hi
>
> Can you help me in resoving a issue i am facing with SDO C++
> implementation.
>
> 1. I have 2 xsd's and I am loading the main XSD (Audit) along with the xml
> in the SDO C++ program
> 2. However, when the xml load is done (using xmlhelper) I dont see the
> data
> for "AuditTable" element , I see the data only for "AuditID" element
>
> 3. When i change the type for "AuditTable" element as below, The xml
> loading
> happens
>  <xs:element name="AuditTable" type="stype:ENUM" minOccurs="0"/>
>
> 4. What could be the reason for this behaviour? Is it that SDO C++ does
> not
> support <complexContent>?
> I have tried even changing that to <simpleContent> as well.. but still no
> luck
>
>
> Please help me out.
>
>
>
>
> AUDIT.XSD
> -------------
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:tns="http://www.xyz.com/cash" xmlns:xs="
> http://www.w3.org/2001/XMLSchema" xmlns:stype="http://www.xyz.com/stype"
> targetNamespace="http://www.xyz.com/cash" elementFormDefault="qualified">
>  <xs:import namespace="http://www.xyz.com/stype"
> schemaLocation="stype.xsd"/>
>  <xs:element name="AUDIT">
>  <xs:complexType>
>   <xs:sequence>
>    <xs:element name="AuditId" type="stype:STRING" minOccurs="0"/>
>    <xs:element name="AuditTable" type="tns:sTable" minOccurs="0"/>
>   </xs:sequence>
>  </xs:complexType>
>  </xs:element>
>  <xs:complexType name="AuditTable">
>   <xs:complexContent>
>    <xs:extension base="stype:ENUM"/>
>   </xs:complexContent>
>  </xs:complexType>
> </xs:schema>
>
>
>
> ----------------------------------------------------------------------------------------------
>
> STYPE.XSD
> --------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sutype="
> http://www.xyz.com/stype" targetNamespace="http://www.xyz.com/stype"
> elementFormDefault="qualified">
>  <xs:complexType name="ENUM">
>  <xs:simpleContent>
>   <xs:extension base="xs:string">
>    <xs:attribute name="TYPE" fixed="ENUM"/>
>    <xs:attribute name="derived" use="optional"/>
>    <xs:attribute name="readonly" use="optional"/>
>    <xs:attribute name="required" use="optional"/>
>   </xs:extension>
>  </xs:simpleContent>
>  </xs:complexType>
>  <xs:complexType name="STRING">
>   <xs:simpleContent>
>    <xs:extension base="xs:string">
>     <xs:attribute name="TYPE" use="optional"/>
>     <xs:attribute name="derived" use="optional"/>
>     <xs:attribute name="readonly" use="optional"/>
>     <xs:attribute name="required" use="optional"/>
>    </xs:extension>
>   </xs:simpleContent>
>  </xs:complexType>
>
>
> ---------------------------------------------------------------------------
> AUDIT.XML
>
> <?xml version="1.0" encoding="UTF-8"?>
> <tns:AUDIT xsi:schemaLocation="http://www.xyz.com/cash AUDIT.xsd"
> xmlns:tns="http://www.xyz.com/cash" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance">
>  <tns:Audit_Id>AUDITID</tns:Audit_Id>
>  <tns:Audit_Table>ABCD</tns:Audit_Table>
> </tns:AUDIT>
> -----------------------------------
>

Hi Prashanth

Are you seeing any errors reported when you load the XML?

Looking at it purely manually you have elements, for example, called
<tns:Audit_Table>ABCD</tns:Audit_Table> but defined as <xs:element
name="AuditTable" type="tns:sTable" minOccurs="0"/>.

Regards

Simon