1 Reply Latest reply: Sep 24, 2013 6:15 AM by odie_63 RSS

    Register schema error for invalid attribute SQLName

    991278

      Hi ,

       

      I am trying to Register an XSD for Object Relational Storage in my DB 11.2.0.3. I get the below mentioned error when I try to register the schema. I think I am going wrong somewhere in schema annotations because without them it was registering fine.

      I just want the underlying tables created from "element names" to have name annotations as mentioned in "xdb:SQLName" type.

      Any assistance would be appreciated - thanks.

       

      BEGIN
      DBMS_XMLSCHEMA.REGISTERSCHEMA(
      SCHEMAURL=>'http://localhost/public/xsd/ObjectRelXSD.xsd',
      SCHEMADOC=>'<?xml version="1.0" encoding="UTF-8"?>
                  <xs:schema
                   xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   xmlns:xdb="http://xmlns.oracle.com/xdb">
                    <xs:element name="purchaseOrder" xdb:SQLName="PURCHASE_ORDER">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element ref="Ordername"/>
                          <xs:element ref="Orderid"/>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="OrderType" xdb:SQLName="ORDER_TYPE">
                        <xs:complexType>
                            <xs:sequence>
                              <xs:element minOccurs="1" maxOccurs="1" ref="Orderdetails"/>
                            </xs:sequence>
                        </xs:complexType>
                    </xs:element>
                    <xs:element name="Orderinstance" type="xs:string" xdb:SQLName="ORDER_INSTANCE"/>
                    <xs:element name="Orderexpiry" xdb:SQLName="ORDER_EXPIRY">
                        <xs:complexType>
                          <xs:sequence>
                            <xs:element minOccurs="0" maxOccurs="unbounded" ref="Expiryinfo"/>
                          </xs:sequence>
                        </xs:complexType>
                    </xs:element>
                    <xs:element name="Ordervalue" type="xs:string" xdb:SQLName="ORDER_VALUE"/>
                    <xs:element name="Ordercode" type="xs:string" xdb:SQLName="ORDER_CODE"/>
                  </xs:schema>
                  ',
         LOCAL     => TRUE,
         GENTYPES  => TRUE,
         GENTABLES => TRUE);
      END;
      /
      

       

      Error:-

       

      Error report -

      ORA-31082: invalid attribute "SQLName" specified in declaration of "purchaseOrder"

      ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 3

      ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 14

      ORA-06512: at line 2

      31082. 00000 -  "invalid attribute \"%s\" specified in declaration of \"%s\""

      *Cause:    The XML schema specifies an invalid attribute.

      *Action:   Remove specification of the invalid attribute.

       

      Message was edited by: 991278

        • 1. Re: Register schema error for invalid attribute SQLName
          odie_63

          First question : do you really want to create tables for every top-level elements declared in the schema ?

          Personally, I wouldn't.

          I'd just create one for the root element (purchaseOrder), whose name we can control via the xdb:defaultTable annotation.

          Use xdb:defaultTable="" to prevent Oracle from generating them.

           

          Secondly, xdb:SQLName controls the naming of the generated object attributes, so doesn't apply to a root element.

          XML Schema Storage and Query: Basic

           

          Besides, the schema you gave is invalid (not only because of the annotations), so I guess it's not the real one, is it?