Hi All,
I am trying to register an XSD having import statements.
I got the below XSD'S from XSD Tutorial - Part 4/5 - Using XML Schema Namespaces site. I modified this add added XDB to be able to registerinto the database.
We are using
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
My first XSD is CommonTypes.xsd
<?xmlversion="1.0" encoding="utf-16"?>
<!-- Created with Liquid XML Studio 0.9.8.0 (http://www.liquid-technologies.com)-->
<xs:schema targetNamespace="http://NamespaceTest.com/CommonTypes"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
xmlns:xdb="http://www.oracle.com/xdb"
xdb:storeVarrayAsTable="true">
<xs:complexTypename="AddressType">
<xs:sequence>
<xs:element name="Line1" type="xs:string" />
<xs:element name="Line2" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:simpleTypename="PriceType">
<xs:restriction base="xs:decimal">
<xs:fractionDigitsvalue="2" />
</xs:restriction>
</xs:simpleType>
<xs:simpleTypename="PaymentMethodType">
<xs:restriction base="xs:string">
<xs:enumeration value="VISA" />
<xs:enumeration value="MasterCard" />
<xs:enumeration value="Cash" />
<xs:enumeration value="Amex" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
I used the below command to register it into Database.
BEGIN
DBMS_XMLSCHEMA.registerSchema(
schemaURL=>'http://localhost:8080/SCMS/CommonTypes.xsd',
schemaDoc => BFILENAME ('MK_DIR','CommonTypes.xsd'),
local=> TRUE,
genTypes=>TRUE,
genbean=>FALSE,
genTables=>TRUE,
csid=>nls_charset_id('AL16UTF16LE'));
END;
It is successfully registered.
Now I took my second XSD as given below and imported the CommTypes XSD into it.
<?xmlversion="1.0" encoding="utf-16"?>
<!-- Created with Liquid XML Studio 0.9.8.0 (http://www.liquid-technologies.com)-->
<xs:schema xmlns:cmn="http://NamespaceTest.com/CommonTypes"
targetNamespace="http://NamespaceTest.com/CustomerTypes"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
xmlns:xdb="http://www.oracle.com/xdb"
xdb:storeVarrayAsTable="true">
<xs:import schemaLocation="CommonTypes.xsd"
namespace="http://NamespaceTest.com/CommonTypes"/>
<xs:complexType name="CustomerType">
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="DeliveryAddress" type="cmn:AddressType" />
<xs:element name="BillingAddress" type="cmn:AddressType" />
</xs:sequence>
</xs:complexType>
</xs:schema>
Now when I am trying to register the XSD it is not working. It is throwing an error.
BEGIN
DBMS_XMLSCHEMA.registerSchema(
schemaURL=>'http://localhost:8080/SCMS/CustomerTypes.xsd',
schemaDoc=> BFILENAME ('MK_DIR','CustomerTypes.xsd'),
local=> TRUE,
genTypes=>TRUE,
genbean=>FALSE,
genTables=>TRUE,
csid=>nls_charset_id('AL16UTF16LE'));
END;