Skip to Main Content

Database Software

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!

XMLSchema minOccurs, maxOccurs not validated with object-relational storage

655829Aug 20 2008 — edited Aug 20 2008
The XML document does not get validated with XML Schema element properties “minOccurs”, “maxOccurs”. This occurs with the structured/object-relational storage of XML files.
###########################################
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="ConfigRoot" xmlns:xdb="http://xmlns.oracle.com/xdb" targetNamespace="ConfigRoot" elementFormDefault="qualified">

<xsd:element name="ConfigRoot" xdb:defaultTable="CONFIG_TBL_ISSUE1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="element1" type="xsd:integer" minOccurs="0"/>
<xsd:element name="element2" type="xsd:boolean"/>
<xsd:element name="element3" type="xsd:string" minOccurs="0" maxOccurs="2"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
###########################################

For the above XSD ,
element1 -> minOccurs = 0
element2 -> minOccurs = 1
element2 -> minOccurs = 0, maxOccurs = 2.


The above schema is registered in Oracle XML DB with relational storage. On loading tables with XML document, the following are not validated
1. If element2 is not present, it is not throwing error like “only 0 occurrences of particle "element2", minimum is 1”.
2. If none of the element is present under the node, it is not throwing any error

The above cases, schema validation fails. The XML schema is registered with the following command
>>
BEGIN
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => 'Issue_1.xsd',
SCHEMADOC => bfilename ('XMLDIR_A', 'Issue_1.xsd'),
OWNER => USER
);
end;
/
>>


The sample XML looks as below
###########################################
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Sample XML file generated by XMLSpy v2008 rel. 2 sp1 (http://www.altova.com)
-->
<ConfigRoot xsi:schemaLocation="ConfigRoot Issue_1.xsd" xmlns="ConfigRoot" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<element1>0</element1>
<element3>String</element3>
<element3>String</element3>
</ConfigRoot>

###########################################

I am using Oracle Database 11g on Fedora Core 4, x86 machine.
PL/SQL Release 11.1.0.6.0, CORE 11.1.0.6.0
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 17 2008
Added on Aug 20 2008
1 comment
723 views