Reputation: 69
I have the following error when run this code:
ERROR en lÝnea 1: ORA-30937: No hay ninguna definici¾n de esquema para 'assert' (espacio de nombres 'http://www.w3.org/2001/XMLSchema') en el principal '/schema/element[1]/complexType/sequence/element[1]/complexType/sequence/element[3]/complexType' ORA-06512: en "XDB.DBMS_XMLSCHEMA_INT", lÝnea 3 ORA-06512: en "XDB.DBMS_XMLSCHEMA", lÝnea 14 ORA-06512: en lÝnea 31
The code is pl/sql version oracle BD 11g
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
declare
doc varchar2(30000) := '<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
<xs:element name="root" vc:minVersion="1.1">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="node">
<xs:complexType>
<xs:sequence>
<xs:element name="type" type="xs:string" />
<xs:element name="info" type="xs:string" />
<xs:element minOccurs="0" name="detail">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="address" type="xs:string" />
</xs:sequence>
<xs:assert test="((type = ''B'') and detail) or (type=''A'')" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>';
begin
dbms_xmlschema.registerSchema('procesos/gsioper/solicitudes/solicitud5.xsd', doc);
end;
I want to implement a XSD Schema when the tag type = 'B', it is mandatory to register the tag detail like this:
<root>
<node>
<type>A</type>
<info>info</info>
</node>
<node>
<type>A</type>
<info>info</info>
</node>
<node>
<type>B</type>
<info>info</info>
<detail>
<name>john</name>
<address>downtown</address>
</detail>
</node>
</root>
Thanks in advance
Upvotes: 1
Views: 494
Reputation: 111696
Oracle doesn't support XSD 1.1, which is required for xs:assert
.
You'll have to remove xs:assert
and forgo (or find a non-XSD-based alternative for) enforcing its constraint.
Upvotes: 0