Registering XML Schema with an xsd that includes another xsd
155832Aug 3 2006 — edited Aug 21 2006Hi I am trying to register and XML Schema based on the Envelope.xsd file which includes other xsd's. I do the following and get an error:
I put all the xsd’s into Unix in the directory defined as ‘ORA_DATA_OUT’ as follows:
$ ll *.xsd
-rw------- 1 danielv project 2049 Apr 14 07:27 AllocEnvelope.xsd
-rw------- 1 danielv project 1094 May 23 2005 AllocRejectStatusEnvelope.xsd
-rw------- 1 danielv project 718 May 23 2005 AllocStatusEnvelope.xsd
-rw------- 1 danielv project 978 Apr 18 14:54 AsnEnvelope.xsd
-rw------- 1 danielv project 1156 May 23 2005 AsnReviseEnvelope.xsd
-rw------- 1 danielv project 936 Jun 30 09:55 Envelope.xsd
-rw------- 1 danielv project 784 May 26 12:20 ReceiptEnvelope.xsd
-rw------- 1 danielv project 1113 May 23 2005 RefusalEnvelope.xsd
-rw------- 1 danielv project 8996 Apr 20 08:24 entityIncludes.xsd
-rw------- 1 danielv project 1980 May 23 2005 includes.xsd
And then I called the following script in SQLPLUS which loads the Envelope.xsd as a binary file and registers the database and got the following error:
declare
xsd_file bfile := bfilename('ORA_DATA_OUT', 'Envelope.xsd');
BEGIN
DBMS_XMLSCHEMA.registerSchema('http://www.w3.org/2001/XMLSchema', xsd_file);
EXCEPTION
WHEN DBMS_LOB.NOEXIST_DIRECTORY THEN
dbms_output.put_line('Directory does not exist: '||SQLERRM);
WHEN OTHERS THEN
dbms_output.put_line ('Error is: '||SQLERRM);
END;
/
show errors
Error is: ORA-31000: Resource 'AllocEnvelope.xsd' is not an XDB schema document
My Envelope.xsd looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by User (Profit Logic Inc.) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="AllocEnvelope.xsd"/>
<xs:include schemaLocation="AllocRejectStatusEnvelope.xsd"/>
<xs:include schemaLocation="AllocStatusEnvelope.xsd"/>
<xs:include schemaLocation="AsnEnvelope.xsd"/>
<xs:include schemaLocation="AsnReviseEnvelope.xsd"/>
<xs:include schemaLocation="ReceiptEnvelope.xsd"/>
<xs:include schemaLocation="RefusalEnvelope.xsd"/>
<xs:element name="ProfitLogic">
<xs:complexType>
<xs:choice>
<xs:group ref="allocType"/>
<xs:group ref="allocRejectStatusType"/>
<xs:group ref="allocStatusType"/>
<xs:group ref="asnType"/>
<xs:group ref="asnReviseType"/>
<xs:group ref="receiptType"/>
<xs:group ref="refusalType"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
And the AllocEnvelope.xsd looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="includes.xsd"/>
<xs:include schemaLocation="entityIncludes.xsd"/>
<xs:group name="allocType">
<xs:sequence>
<xs:element name="Header" type="allocHeaderType"/>
<xs:element name="Body" type="allocBodyType"/>
</xs:sequence>
</xs:group>
<xs:complexType name="allocHeaderType">
<xs:complexContent>
<xs:extension base="headerType">
<xs:attribute name="type" type="xs:string" use="required" fixed="Alloc"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="allocBodyType">
<xs:complexContent>
<xs:extension base="allocIdType">
<xs:sequence>
<xs:element name="AllocInfo" type="allocInfoNodeType"/>
<xs:element name="PONode" type="poNodeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DCNode" type="dcNodeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="StoreNode" type="storeNodeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Merchandise" type="merchandiseType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Pack" type="packType" maxOccurs="unbounded"/>
<xs:element name="PONodePack" type="poNodePackType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DCNodePack" type="dcNodePackType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Allocation" type="allocationType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="allocationType">
<xs:attribute name="sourceNodeId" type="xs:string" use="required"/>
<xs:attribute name="sourceType" type="xs:string" use="required"/>
<xs:attribute name="destNodeId" type="xs:string" use="required"/>
<xs:attribute name="destType" type="xs:string" use="required"/>
<xs:attribute name="packId" type="xs:string" use="required"/>
<xs:attribute name="units" type="xs:positiveInteger" use="required"/>
</xs:complexType>
</xs:schema>