This discussion is archived
14 Replies Latest reply: Jun 7, 2012 11:12 AM by 878240 RSS

ORA-30937: No schema definition

878240 Newbie
Currently Being Moderated
I'm trying to load an xml table SAMSEDAILY using sqlldr. I created a schema as follows

DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => 'SamseDaily_gp.xsd',
SCHEMADOC => bfilename('XSD_DIR', 'SamseDaily_gp5.xsd'),
LOCAL => TRUE,
GENTYPES => TRUE,
GENTABLES => TRUE);

This is the start of the schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://samsedaily.org/namespace"
xmlns:samdly="http://samsedaily.org/namespace"
xmlns="http://samsedaily.org/namespace"
xmlns:xdb="http://xmlns.oracle.com/xdb"
xmlns:smse="http://xmlns.oracle.com/xdb/schemas/XDB/samsecommon.xsd" >
          <xs:element name="SamseDaily" xdb:defaultTable="SAMSEDAILY" xdb:SQLName="SAMSEDAILY">
               <xs:annotation>
               <xs:documentation>Work Order and Inventory data reported daily to higher</xs:documentation>
               </xs:annotation>
               <xs:complexType xdb:SQLType="SAMSEDAILY_T">
                    <xs:sequence>
                    <xs:element name="FileInfo" nillable="true" smse:type="SamseFileInfoType" xdb:SQLName="FILEINFO"/>


When I have this in the file samsedaily2.xml

*<SamseDaily xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="SamseDaily_gp.xsd">*

it results in

ORA-30937: No schema definition for 'SamseDaily' (namespace 'SamseDaily_gp.xsd') in parent '/'

I also tried using this in samsedaily2.xml

*<SamseDaily xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://samsedaily.org/namespace">*

which uses the targetNamespace. It gives the same error but the element name it can't find in the schema is "FileInfo" instead of "SamseDaily".

ORA-30937: No schema definition for 'FileInfo' (namespace 'http://samsedaily.org/namespace') in parent '/SamseDaily'

FileInfo is the next element under SamseDaily in the schema (see above). The type="SamseFileInfoType" is defined in another schema as shown above.

This is the control file:

LOAD DATA
INFILE *
INTO TABLE SAMSEDAILY TRUNCATE
XMLType(xmldata)
FIELDS(
xmldata LOBFILE (CONSTANT samsedaily2.xml) TERMINATED BY eof
)
begindata
0

Thank you for your help.

Edited by: user4109719 on May 25, 2012 9:21 AM

Edited by: user4109719 on May 25, 2012 9:33 AM
  • 1. Re: ORA-30937: No schema definition
    odie_63 Guru
    Currently Being Moderated
    Please always give your database version when posting (all digits from : select * from v$version). Thanks.
    *<SamseDaily xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://samsedaily.org/namespace">*
    Yes, you must use the target namespace, and optionally the xsi:schemaLocation attribute too for versions < 10.2.0.x.
    Declaring "xmlns:xsd" is useless in this case.

    FileInfo is the next element under SamseDaily in the schema (see above). The type="SamseFileInfoType" is defined in another schema as shown above.
    I don't see any xsd:import or xsd:include directives in the schema definition.
    I wonder how's the external type is resolved?

    Does the SamseFileInfoType define elements in the same target namespace?
  • 2. Re: ORA-30937: No schema definition
    878240 Newbie
    Currently Being Moderated
    The version is 11.2.0.2.0.

    The SamseFileInfoType is from the *"http://xmlns.oracle.com/xdb/schemas/XDB/samsecommon.xsd"* schema which has
    targetNamespace="http://samsecommon_gp.xsd/namespace".

    With respect to SamseFileInfo I thought having this entry

    xmlns:smse="http://xmlns.oracle.com/xdb/schemas/XDB/samsecommon.xsd"

    and using the smse prefix was sufficient. I was able to import an xml file from another schema which also references that schema without using the "import" or "include".

    When I add an import tag it invalidates the xmlns references inside the schema tag. For example I tried adding this:

    *<xs:import schemaLocation="http://www.w3.org/2001/XMLSchema-instance">*

    and it results in

    ORA-30937: No schema definition for 'element' (namespace 'http://www.w3.org/2001/XMLSchema')

    I also tried adding *<xs:import schemaLocation="http://samsecommon_gp.xsd/namespace"/>* with the same resulting error.

    Thanks.
  • 3. Re: ORA-30937: No schema definition
    odie_63 Guru
    Currently Being Moderated
    With respect to SamseFileInfo I thought having this entry

    xmlns:smse="http://xmlns.oracle.com/xdb/schemas/XDB/samsecommon.xsd"

    and using the smse prefix was sufficient. I was able to import an xml file from another schema which also references that schema without using the "import" or "include".
    That's a hack actually. You shouldn't be using Oracle reserved namespace and url under XDB.
    Using xsd:import (or include in case both schemas share the same target namespace) is the correct way :
    <xsd:import namespace="http://samsecommon_gp.xsd/namespace" schemaLocation="<url used for registration>"/>
    Is there an elementFormDefault attribute in the "imported" schema?

    Actually, it'd be great if you could post both schemas (or abridged but functional versions) to see what you're really dealing with.
  • 4. Re: ORA-30937: No schema definition
    odie_63 Guru
    Currently Being Moderated
    Here's an example :

    CommonTypes schema
    begin
      dbms_xmlschema.registerSchema(
        schemaURL => 'CommonTypes.xsd'
      , schemaDoc => 
    
    '<?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://www.sample.org/common"
      xmlns="http://www.sample.org/common"
      xmlns:xdb="http://xmlns.oracle.com/xdb">
      <xsd:complexType name="itemType" xdb:SQLType="ITEM_T" xdb:maintainDOM="false">
        <xsd:sequence>
          <xsd:element name="id" type="xsd:integer"/>
          <xsd:element name="val" type="xsd:string"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>'
    
      , local => true
      , genTypes => true
      , genTables => false
      , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
      ); 
    end;
    /
    MainSchema
    begin
      dbms_xmlschema.registerSchema(
        schemaURL => 'MainSchema.xsd'
      , schemaDoc => 
    
    '<?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://www.sample.org/main"
      xmlns="http://www.sample.org/main"
      xmlns:c="http://www.sample.org/common"
      xmlns:xdb="http://xmlns.oracle.com/xdb">
      <xsd:import namespace="http://www.sample.org/common" schemaLocation="CommonTypes.xsd"/>
      <xsd:element name="root" xdb:defaultTable="MAIN_XML">
        <xsd:complexType xdb:SQLType="ROOT_T" xdb:maintainDOM="false">
          <xsd:sequence>
            <xsd:element name="item" type="c:itemType" maxOccurs="unbounded" xdb:SQLCollType="ITEM_COLL"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>'
    
      , local => true
      , genTypes => true
      , genTables => true
      , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
      ); 
    end;
    /
    MainSchema.xsd imports CommonTypes.xsd and its target namespace and uses "itemType" to define "item" element.

    Both schemas don't have any elementFormDefault attribute in their root element, therefore the default "unqualified" applies.
    That means all elements (except globally-defined ones) belong to no namespace, so in this case, a valid instance document looks like :
    <?xml version="1.0" encoding="UTF-8"?>
    <m:root xmlns:m="http://www.sample.org/main">
     <item>
      <id>1</id>
      <val>TEST1</val>
     </item>
     <item>
      <id>2</id>
      <val>TEST2</val>
     </item>
    </m:root>
    Then, such document could be inserted into the default table using SQL or SQL*Loader.
    FTP or WebDAV could be used too provided a namespace mapping is declared at the XDB Repository level, or if the schemaLocation is specified in the root :
    <?xml version="1.0" encoding="UTF-8"?>
    <m:root xmlns:m="http://www.sample.org/main"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://www.sample.org/main MainSchema.xsd">
     <item>
      <id>1</id>
      <val>TEST1</val>
     </item>
     <item>
      <id>2</id>
      <val>TEST2</val>
     </item>
    </m:root>
    For example, using SQL and the BFILE constructor :
    SQL> insert into main_xml values(
      2   xmltype(bfilename('TEST_DIR', 'test.xml'), nls_charset_id('AL32UTF8'))
      3  );
     
    1 row inserted
     
    SQL> 
    SQL> select x.*
      2  from main_xml t
      3     , xmltable(
      4         xmlnamespaces('http://www.sample.org/main' as "m")
      5       , '/m:root/item' passing t.object_value
      6         columns "id", "val"
      7     ) x
      8  ;
     
             id val
    ----------- -------------
              1 TEST1
              2 TEST2
     
    Edited by: odie_63 on 30 mai 2012 22:19
  • 5. Re: ORA-30937: No schema definition
    878240 Newbie
    Currently Being Moderated
    I changed the schemas out of the Oracle namespace as you suggested. After using your include it now takes the import statement but when importing the xml file it again doesn't recognize fileinfo type. This is the start of the schema:


    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://samsedaily.org/namespace"
    xmlns:samdly="http://samsedaily.org/namespace"
    xmlns="http://samsedaily.org/namespace"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xmlns:smse="http://www.w3.org/samsecommon.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
    <xsd:import namespace="http://samsecommon.xsd/namespace" schemaLocation="http://www.w3.org/samsecommon.xsd"/>
              <xs:element name="SamseDaily" xdb:defaultTable="SAMSEDAILY" xdb:SQLName="SAMSEDAILY">
                   <xs:annotation>
                   <xs:documentation>Work Order and Inventory data reported daily to higher</xs:documentation>
                   </xs:annotation>
                   <xs:complexType xdb:SQLType="SAMSEDAILY_T">
                        <xs:sequence>
                        *<xs:element name="FileInfo" nillable="true" smse:type="SamseFileInfoType" xdb:SQLName="FILEINFO"/>*

    This is the start of the xml file:

    <SamseDaily xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://samsedaily.org/namespace">
    <FileInfo>

    I also tried making them the same namespace - "http://samsecommon.xsd/namespace" and using "include". It then apparently recognized <FileInfo> but didn't recognize the SamseDaily type.

    The xml file from a different schema that is loading doesn't need the import or include. It does have the xmlns:smse="http://www.w3.org/samsecommon.xsd".

    This is the start of the "http://www.w3.org/samsecommon.xsd" schema:

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema elementFormDefault="qualified"
    xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xdb:storeVarrayAsTable="true"
    targetNamespace="http://samsecommon.xsd/namespace"
    xmlns:smse="http://samsecommon.xsd/namespace">

    It has a bunch of simple types and then the SamseFileInfoType

    <xs:complexType name="SamseFileInfoType" xdb:SQLType="SAMSEFILEINFO_T">
    <xs:sequence>
    <xs:element name="FileInfo">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="OriginaFilelName" type="xs:string"/>
    <xs:element name="Source">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Name" type="xs:string"/>
    <xs:element name="Version" type="xs:decimal"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="Submitter">
    <xs:complexType xdb:SQLType="SUBMITTER_T">
    <xs:sequence>
    <xs:element name="UIC" type="smse:UICType" xdb:SQLName="UIC"/>
    <xs:element name="CRTFMT" type="smse:CRTFMTType" nillable="true" xdb:SQLName="CRTFMT"/>
    <xs:element name="UnitName" xdb:SQLName="UNITNAME">
    <xs:simpleType>
    <xs:restriction base="xs:token">
    <xs:minLength value="1"/>
    <xs:maxLength value="80"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="OrgLocCde" type="smse:OrgLocCdeEnum" nillable="true"/>
    <xs:element name="DPICode" type="smse:DPICodeType" nillable="true" xdb:SQLName="DPICODE"/>
    <xs:element name="UnitPOC" nillable="true">
    <xs:simpleType>
    <xs:restriction base="xs:token">
    <xs:minLength value="1"/>
    <xs:maxLength value="30"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="IP" type="xs:token"/>
    <xs:element name="POCEmail" type="smse:EmailAddressType" nillable="true" xdb:SQLName="POCEMAIL"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="CreatedDate" type="xs:dateTime"/>
    <xs:element name="Period">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="StartDate" type="xs:dateTime"/>
    <xs:element name="EndDate" type="xs:dateTime"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
  • 6. Re: ORA-30937: No schema definition
    odie_63 Guru
    Currently Being Moderated
    You're mixing up things, in particular namespace vs. schema location.
    Try to give them private and meaningful names (again, w3.org is not a good idea).

    Check my example again, it's close to your situation and should help you understand the logic.

    Some additional comments...

    About the main schema :
    smse:type="SamseFileInfoType"
    should be this instead :
    type="smse:SamseFileInfoType"
    and the smse prefix must refer to the imported namespace not to the schema location.
    So in the root element, it should be :
    xmlns:smse="http://samsecommon.xsd/namespace"
    About the imported schema :
    It has elementFormDefault="qualified", that means you must use qualified names for elements defined in this schema.

    A valid instance document would then begin with :
    <sd:SamseDaily xmlns:sd="http://samsedaily.org/namespace"
                   xmlns:smse="http://samsecommon.xsd/namespace">
      <FileInfo>
        <smse:FileInfo>
          <smse:OriginalFileName>ABC</smse:OriginalFileName>
          <smse:Source>
            ...
    Edited by: odie_63 on 31 mai 2012 11:27 - corrected instance doc after re-reading the schema
  • 7. Re: ORA-30937: No schema definition
    878240 Newbie
    Currently Being Moderated
    I made your changes, i.e. type="smse:SamseFileInfoType" and xmlns:smse="http://samsecommon.xsd/namespace".

    In the instance file I have this:

    <?xml version="1.0" encoding="utf-8"?>
    <SamseDaily xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:smse="http://samsecommon.xsd/namespace" xmlns="http://samsedaily.org/namespace">
    <smse:FileInfo>
    <smse:OriginaFilelName>E:\New Folder\SAMSEDAILY.XML</smse:OriginaFilelName>
    <smse:Source>
    <smse:Name>SAMSEDAILY</smse:Name>
    <smse:Version>1.0</smse:Version>
    </smse:Source>
    <smse:Submitter>
    <smse:UIC>WAX1A0</smse:UIC>
    <smse:CRTFMT>CRT</smse:CRTFMT>
    <smse:UnitName>A CO, 1-10 AVN</smse:UnitName>
    <smse:OrgLocCde>A</smse:OrgLocCde>
    <smse:DPICode>Need LOGSA DPICode</smse:DPICode>
    <smse:UnitPOC />
    <smse:IP>192.168.1.1</smse:IP>
    <smse:POCEmail xsi:nil="true" />
    </smse:Submitter>
    <smse:CreatedDate>2012-05-11T11:24:55.3453049-04:00</smse:CreatedDate>
    <smse:Period>
    <smse:StartDate>2012-05-11T00:00:00</smse:StartDate>
    <smse:EndDate>2012-05-11T00:00:00</smse:EndDate>
    </smse:Period>
    </smse:FileInfo>


    It is still not recognizing the FileInfo element:

    Record 1: Rejected - Error on table ULLSAE.SAMSEDAILY.
    ORA-30937: No schema definition for 'FileInfo' (namespace 'http://samsecommon.xsd/namespace') in parent '/SamseDaily'

    Is there something wrong with how the FileInfo element is constructed in the schema definition? It's being accepted so I wouldn't think so.

    Thanks.

    Edited by: user4109719 on Jun 1, 2012 12:07 PM
  • 8. Re: ORA-30937: No schema definition
    odie_63 Guru
    Currently Being Moderated
    Is there something wrong with how the FileInfo element is constructed in the schema definition?
    Well, I already gave you what I think is a valid instance...

    The main schema declares a FileInfo element under the root element.
    Now, that FileInfo element, as per the imported schema, must contain again another FileInfo element but this time in the "smse" namespace :
    <xs:complexType name="SamseFileInfoType" xdb:SQLType="SAMSEFILEINFO_T">
    <xs:sequence>
    <xs:element name="FileInfo">
    <xs:complexType>
    <xs:sequence>
    ...
    All that means the correct sequence of nodes should be :
    <sd:SamseDaily xmlns:sd="http://samsedaily.org/namespace"
                   xmlns:smse="http://samsecommon.xsd/namespace">
      <FileInfo>
        <smse:FileInfo>
          <smse:OriginalFileName>ABC</smse:OriginalFileName>
          <smse:Source>
     ...
    - The SamseDaily element must be qualified (because it's a globally-defined element)
    - The first FileInfo under it (defined in the main schema) must be unqualified, since it's the default behaviour in absence of the elementFormDefault attribute
    - The second FileInfo (defined in the imported schema as part of the complexType) must be qualified with its namespace of origin, since this time elementFormDefault = "qualified" in the schema
  • 9. Re: ORA-30937: No schema definition
    878240 Newbie
    Currently Being Moderated
    I got

    Record 1: Rejected - Error on table ULLSAE.SAMSEDAILY.
    ORA-30937: No schema definition for 'FileInfo' (namespace 'http://samsedaily.org/namespace') in parent '/SamseDaily'

    This is how the instance file starts:


    <?xml version="1.0" encoding="utf-8"?>
    <SamseDaily xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:smse="http://samsecommon.xsd/namespace" xmlns="http://samsedaily.org/namespace">
    <FileInfo>
    <smse:FileInfo>
    <OriginaFilelName>E:\New Folder\SAMSEDAILY.XML</OriginaFilelName>
    <Source>
    <Name>SAMSEDAILY</Name>
    <Version>1.0</Version>
    </Source>
    <Submitter>
    <smse:UIC>WAX1A0</smse:UIC>
    <smse:CRTFMT>CRT</smse:CRTFMT>

    It seems that the first FileInfo would have to be defined in the samsedaily namespace would it not? I don't understand how that solves the problem of it not recognizing the samsecommon prefixed fields.

    I didn't put the smse prefix in front of every field just the ones that have a type defined in http://samsecommon.xsd/namespace. For example OriginaFilelName is only defined within the FileInfoType. Is it needed for every field?


    Also as a test I decided to eliminate the samsecommon namespace and have everything in the samsedaily namespace. I cut it down to just the the FileInfoType. I want to try to load an xml file with only the FileInfo element.

    This is the entire schema:

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://samsedaily.org/namespace"
    xmlns:samdly="http://samsedaily.org/namespace"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
    <xs:element name="SamseDaily" xdb:defaultTable="SAMSEDAILY" xdb:SQLName="SAMSEDAILY">
              <xs:annotation>
              <xs:documentation>Work Order and Inventory data reported daily to higher</xs:documentation>
              </xs:annotation>
    <xs:complexType xdb:SQLType="SAMSEDAILY_T">
         <xs:sequence>
    <xs:element name="FileInfo">
    <xs:sequence>
    <xs:complexType xdb:SQLType="SAMSEFILEINFO_T">
    <xs:element name="OriginaFilelName" type="xs:string"/>
    <xs:element name="Source">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Name" type="xs:string"/>
    <xs:element name="Version" type="xs:decimal"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="Submitter">
    <xs:complexType xdb:SQLType="SUBMITTER_T">
    <xs:sequence>
    <xs:element name="UIC">
    <xs:simpleType name="UICType" >
    <xs:restriction base="xs:token">
    <xs:minLength value="1"/>
    <xs:maxLength value="6"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="CRTFMT">
    <xs:simpleType name="CRTFMTType" >
    <xs:restriction base="xs:token">
    <xs:length value="4"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:complexType>
    </xs:sequence>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>

    When I try to create the schema it gives an error:

    ERROR at line 1:
    ORA-30937: No schema definition for 'sequence' (namespace 'http://www.w3.org/2001/XMLSchema') in par
    *'/schema/element[1]/complexType/sequence/element[1]'*
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 37
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 65
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 136
    ORA-06512: at line 3

    All of a sudden it is not recognizing the xs prefixed fields apparently. I tried it also with elementFormDefault="qualified".
  • 10. Re: ORA-30937: No schema definition
    odie_63 Guru
    Currently Being Moderated
    Hi,

    Why I have the feeling you're not reading (or understanding) any of my explanations? :)

    Let's try again, one last time :
    This is how the instance file starts:
    That's not what I've suggested. Check again.
    It seems that the first FileInfo would have to be defined in the samsedaily namespace would it not? I don't understand how that solves the problem of it not recognizing the samsecommon prefixed fields.
    The SamseDaily element must be namespace-qualified because it's defined globally in the main schema, but its children must not. That's the expected behaviour in the absence of the elementFormDefault attribute (it then defaults to "unqualified").
    To deal with this situation, don't use a default namespace but a prefix instead. I used "sd" in my example.
    I didn't put the smse prefix in front of every field just the ones that have a type defined in http://samsecommon.xsd/namespace. For example OriginaFilelName is only defined within the FileInfoType. Is it needed for every field?
    Yes, it's needed for every element. The elementFormDefault = "qualified" in the imported schema dictates that.
  • 11. Re: ORA-30937: No schema definition
    odie_63 Guru
    Currently Being Moderated
    All of a sudden it is not recognizing the xs prefixed fields apparently.
    You've put a sequence element in place of a complexType, and vice-versa :
    <xs:element name="FileInfo">
    <xs:sequence>
    <xs:complexType xdb:SQLType="SAMSEFILEINFO_T">
    This one is correct, and registers OK :
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://samsedaily.org/namespace"
    xmlns:samdly="http://samsedaily.org/namespace"
    xmlns:xdb="http://xmlns.oracle.com/xdb" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <xs:element name="SamseDaily" xdb:defaultTable="SAMSEDAILY" xdb:SQLName="SAMSEDAILY">
               <xs:annotation>
                 <xs:documentation>Work Order and Inventory data reported daily to higher</xs:documentation>
               </xs:annotation>
         <xs:complexType xdb:SQLType="SAMSEDAILY_T">
           <xs:sequence>
             <xs:element name="FileInfo">
               <xs:complexType xdb:SQLType="SAMSEFILEINFO_T">
                 <xs:sequence>
                   <xs:element name="OriginaFilelName" type="xs:string"/>
                   <xs:element name="Source">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="Name" type="xs:string"/>
                          <xs:element name="Version" type="xs:decimal"/>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="Submitter">
                      <xs:complexType xdb:SQLType="SUBMITTER_T">
                        <xs:sequence>
                          <xs:element name="UIC">
                           <xs:simpleType name="UICType" >
                            <xs:restriction base="xs:token">
                           <xs:minLength value="1"/>
                           <xs:maxLength value="6"/>
                           </xs:restriction>
                        </xs:simpleType> 
                        </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="CRTFMT">
                      <xs:simpleType name="CRTFMTType" >
                       <xs:restriction base="xs:token">
                        <xs:length value="4"/>
                       </xs:restriction>
                     </xs:simpleType>
                    </xs:element>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
             </xs:sequence>
          </xs:complexType>
       </xs:element>
    </xs:schema>
    and here's a valid instance doc :
    <sd:SamseDaily xmlns:sd="http://samsedaily.org/namespace">
     <FileInfo>
      <OriginaFilelName>TEST</OriginaFilelName>
      <Source>
       <Name>Test</Name>
       <Version>1.0</Version>
      </Source>
      <Submitter>
       <UIC>123456</UIC>
      </Submitter>
      <CRTFMT>ABCD</CRTFMT>
     </FileInfo>
    </sd:SamseDaily>
  • 12. Re: ORA-30937: No schema definition
    878240 Newbie
    Currently Being Moderated
    That worked, thanks. I'm trying to add the samsecommon namespace back in. I recreated it with just the simple types (without the FileInfo element):

    This is the start:

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema elementFormDefault="qualified"
    xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xdb:storeVarrayAsTable="true"
    targetNamespace="http://samsecommon.xsd/namespace"
    xmlns:smse="http://samsecommon.xsd/namespace">

    It includes the UICType:

    <xs:simpleType name="UICType" >
    <xs:restriction base="xs:token">
    <xs:minLength value="1"/>
    <xs:maxLength value="6"/>
    </xs:restriction>
    </xs:simpleType>

    Then I modified the SamseDaily schema to use the UICType from samsecommon:

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://samsedaily.org/namespace"
    xmlns:samdly="http://samsedaily.org/namespace"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xmlns:smse="http://samsecommon.xsd/namespace"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <xs:element name="SamseDaily" xdb:defaultTable="SAMSEDAILY" xdb:SQLName="SAMSEDAILY">
              <xs:annotation>
              <xs:documentation>Work Order and Inventory data reported daily to higher</xs:documentation>
              </xs:annotation>
    <xs:complexType xdb:SQLType="SAMSEDAILY_T">
    <xs:sequence>
    <xs:element name="FileInfo">
    <xs:complexType xdb:SQLType="SAMSEFILEINFO_T">
    <xs:sequence>
    <xs:element name="OriginaFilelName" type="xs:string"/>
    <xs:element name="Source">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Name" type="xs:string"/>
    <xs:element name="Version" type="xs:decimal"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    <xs:element name="Submitter">
    <xs:complexType xdb:SQLType="SUBMITTER_T">
    <xs:sequence>
    *<xs:element name="UIC" type="smse:UICType" xdb:SQLName="UIC"/>*
    <xs:element name="CRTFMT">
    <xs:simpleType name="CRTFMTType" >
    <xs:restriction base="xs:token">
    <xs:length value="4"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:schema>

    When I try to register it, it gets an error:

    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00023: unknown namespace URI "http://samsecommon.xsd/namespace"
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 37
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 65
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 136
    ORA-06512: at line 3


    Now what am I doing wrong?

    Thanks.
  • 13. Re: ORA-30937: No schema definition
    odie_63 Guru
    Currently Being Moderated
    Now what am I doing wrong?
    I don't see any <xs:import> element, hence it's unable to resolve the reference to smse:UICType.

    This works :

    SamseCommon.xsd
    begin
      dbms_xmlschema.registerSchema(
        schemaURL => 'SamseCommon.xsd'
      , schemaDoc => 
     
    '<?xml version="1.0" encoding="utf-8"?>
    <xs:schema elementFormDefault="qualified"
     xmlns:xs="http://www.w3.org/2001/XMLSchema"
     xmlns:xdb="http://xmlns.oracle.com/xdb"
     targetNamespace="http://samsecommon.xsd/namespace"
     xmlns:smse="http://samsecommon.xsd/namespace">
      <xs:simpleType name="UICType">
        <xs:restriction base="xs:token">
          <xs:minLength value="1"/>
          <xs:maxLength value="6"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:schema>'
     
      , local => true
      , genTypes => true
      , genTables => false
      , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
      ); 
    end;
    /
    SamseDaily.xsd
    begin
      dbms_xmlschema.registerSchema(
        schemaURL => 'SamseDaily.xsd'
      , schemaDoc => 
     
    '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     targetNamespace="http://samsedaily.org/namespace"
     xmlns:xdb="http://xmlns.oracle.com/xdb"
     xmlns:smse="http://samsecommon.xsd/namespace">
      <xs:import namespace="http://samsecommon.xsd/namespace" schemaLocation="SamseCommon.xsd"/>
      <xs:element name="SamseDaily" xdb:defaultTable="SAMSEDAILY" xdb:SQLName="SAMSEDAILY">
        <xs:annotation>
          <xs:documentation>Work Order and Inventory data reported daily to higher</xs:documentation>
        </xs:annotation>
        <xs:complexType xdb:SQLType="SAMSEDAILY_T">
          <xs:sequence>
            <xs:element name="FileInfo">
              <xs:complexType xdb:SQLType="SAMSEFILEINFO_T">
                <xs:sequence>
                  <xs:element name="OriginaFilelName" type="xs:string"/>
                  <xs:element name="Source">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="Name" type="xs:string"/>
                        <xs:element name="Version" type="xs:decimal"/>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="Submitter">
                    <xs:complexType xdb:SQLType="SUBMITTER_T">
                      <xs:sequence>
                        <xs:element name="UIC" type="smse:UICType" xdb:SQLName="UIC"/>
                        <xs:element name="CRTFMT">
                          <xs:simpleType name="CRTFMTType">
                            <xs:restriction base="xs:token">
                              <xs:length value="4"/>
                            </xs:restriction>
                          </xs:simpleType>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>'
     
      , local => true
      , genTypes => true
      , genTables => true
      , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
      ); 
    end;
    /
    Valid instance :
    <sd:SamseDaily xmlns:sd="http://samsedaily.org/namespace">
     <FileInfo>
      <OriginaFilelName>TEST</OriginaFilelName>
      <Source>
       <Name>Test</Name>
       <Version>1.0</Version>
      </Source>
      <Submitter>
       <UIC>123456</UIC>
       <CRTFMT>ABCD</CRTFMT>
      </Submitter>
     </FileInfo>
    </sd:SamseDaily>
  • 14. Re: ORA-30937: No schema definition
    878240 Newbie
    Currently Being Moderated
    That worked. I think I'm on the right path. Thanks for your valuable help.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points