Forum Stats

  • 3,769,419 Users
  • 2,252,962 Discussions


Adding oracle XSD schema annotations to XSD that imports other XSD files

663047 Member Posts: 2
edited Oct 2, 2008 8:51AM in General XML

I'm trying to use Oracle XML DB's feature that allows adding annotations to an XSD file so Oracle can create the data model (tables, SQL data types) and link the values to the correct data types. As explained in the documentation here: []

This works ok, but once i import another XSD file into my main XSD file, I get the following error when registering the schema in oracle with DBMS_XMLSCHEMA.registerSchema:
+"The given schema URL does not refer to a registered XDB schema"+
This error is usually thrown when you forget to add oracle's xdb namespace to the schema. I've added it in my main XSD file, and in the one i am importing.

I'm using Windows server 2003 with Oracle 11g and running my queries trough SQL Developer.
Below you can find code to reproduce the error

<xsd:schema xmlns:xsd="" xmlns:xdb="">
<!-- without this import DBMS_XMLSCHEMA.registerSchema() works ok -->
<xsd:import schemaLocation="import.xsd"/>

<xsd:schema xmlns:xsd="" xmlns:xdb="">

SQL (example for windows, with files in C:/)
DBMS_XMLSCHEMA.registerSchema('C:/main.xsd', bfilename( 'SCHEMADIR', 'main.xsd' ), TRUE, TRUE, FALSE, TRUE);

Is there any documentation on how to do this? I've found just a small notice in the manual that it -can- be done, but no explanation on how.
Can't find it in the examples either. On one thread i found trough google someone seemed to know how to do this, but didn't bother to explain how.

Thx for anyone that can give me more info on this.


  • 663047
    663047 Member Posts: 2
    I've done some more searching and experimenting and found how this has to be done.

    It is implicitly touched upon in the following section:

    The name used in the XSD file to import another XSD file:
    <xsd:import schemaLocation="import.xsd"/>

    also needs to be used to register the scheme with:
    DBMS_XMLSCHEMA.registerSchema('import.xsd', bfilename( 'SCHEMADIR', 'import.xsd' ), TRUE, TRUE, FALSE, TRUE);

    1) register the schemas that will be imported using the name as used in the mail xsd file
    2) register the main xsd file

    Obvious... :)
    yet undocumented?
This discussion has been closed.