Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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

663047Oct 2 2008 — edited Oct 2 2008
Hi,

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: [http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb05sto.htm#insertedID9]

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

main.xsd
-----
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
<!-- without this import DBMS_XMLSCHEMA.registerSchema() works ok -->
<xsd:import schemaLocation="import.xsd"/>
</xsd:schema>
-----

import.xsd
-----
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
</xsd:schema>
-----

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

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.
Grts,
Wouter
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 30 2008
Added on Oct 2 2008
1 comment
2,061 views