0

The requirement is to register XML schema from XSD files in Oracle 11gR2. I am using the following code:

DECLARE

BEGIN
  DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://[...]/spin-catalog-to-bpm.xsd',
    SCHEMADOC => bfilename ('/home/joe','spin-catalog-to-bpm.xsd'),
    CSID => nls_charset_id('AL32UTF8'));
END;
/

The file spin-catalog-to-bpm.xsd is under /home/joe but when I try to register it, it gives me this error:

DECLARE
*
ERROR at line 1:
ORA-22285: non-existent directory or file for FILEOPEN operation
ORA-06512: at "SYS.DBMS_LOB", line 805
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 131
ORA-06512: at line 3

2 Answers 2

2

You firstly need to create and Oracle directory.

As a user with the relevant permissions:

CREATE OR REPLACE DIRECTORY HOMEJOE AS '/home/joe';

Grant permission to the user that needs to use DBMS_XMLSCHEMA.registerSchema:

GRANT READ, WRITE ON DIRECTORY HOMEJOE TO YOURUSER;

Then register the schema, using the newly created directory:

DECLARE
BEGIN
  DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://[...]/spin-catalog-to-bpm.xsd',
    SCHEMADOC => bfilename ('HOMEJOE','spin-catalog-to-bpm.xsd'),
    CSID => nls_charset_id('AL32UTF8'));
END;
/
1
  • Thanks a lot @Phil, but i am still wondering that what if i don't have access to create directory on database server. There should be a way that i can register xml schema having the xsd file at a remote location. Commented Aug 30, 2013 at 7:44
0

An alternative for saving an XML Schema in a location were you are able to control it is the XDB Repository:

http://docs.oracle.com/cd/B28359_01/appdev.111/b28369/xdb16fol.htm#i1042688

You can create files or select their content via XDB functionality that supports FTP/WebDAV or HTTP...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.