Forum Stats

  • 3,838,997 Users
  • 2,262,435 Discussions
  • 7,900,831 Comments

Discussions

How can you register the GML 3.1.1 schema?

661117
661117 Member Posts: 3
edited Oct 17, 2008 3:48PM in XML DB
I'm trying to register the GML 3.1.1 schema in Oracle v10.2.0.4.0

The GML schema includes and imports other schema and I understand you have to register the imported/included schema prior to registering the schema that import and include etc.

The sequence that I have started to register the gml schema is as below.

I am getting an error:

ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00172: "DefinitionType" is not a valid restriction of "AbstractGMLType"
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 20
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 31
ORA-06512: at line 4

However, the schema is valid so the problem must lie elsewhere.

The question is, am I registering the included schema in the wrong order, (if so can anyone point me on the road to enlightenment), or is this an error in the way Oracle handles schema?

I note that a similar validation error is reported with XML-Spy in the Bytes.com thread ~ http://bytes.com/forum/thread446593.html ...


/* =================== gml 3.1.1 ============= */
/* basicTypes.xsd is the base table */
begin
DBMS_XMLSCHEMA.registerSchema(
schemaURL => 'http://www.opengis.net/gml/3.1.1/base/basicTypes.xsd',
schemaDOC => XDBURIType('/public/tempspaceforschema/diggs/gml/3.1.1/base/basicTypes.xsd').getClob(),
Local => TRUE,
gentypes => TRUE,
gentables => FALSE
);
end;
/

begin
/* gmlBase includes basicTypes.xsd and imports xlink*/
/* for xlink use: http://www.w3.org/1999/xlink/xlinks.xsd */
/* for basic types use: http://www.opengis.net/gml/3.1.1/base/basicTypes.xsd */
DBMS_XMLSCHEMA.registerSchema(
schemaURL => 'http://www.opengis.net/gml/3.1.1/base/gmlBase.xsd',
schemaDOC => XDBURIType('/public/tempspaceforschema/diggs/gml/3.1.1/base/gmlBase.xsd').getClob(),
Local => TRUE,
gentypes => TRUE,
gentables => FALSE
);
end;
/

begin
/* imports gmlbase */
/* for gmlbase use: http://www.opengis.net/gml/3.1.1/base/gmlBase.xsd */
DBMS_XMLSCHEMA.registerSchema(
schemaURL => 'http://www.opengis.net/gml/3.1.1/base/temporal.xsd',
schemaDOC => XDBURIType('/public/tempspaceforschema/diggs/gml/3.1.1/base/temporal.xsd').getClob(),
Local => TRUE,
gentypes => TRUE,
gentables => FALSE
);
end;
/

begin
/* imports gmlbase */
/* for gmlbase use: http://www.opengis.net/gml/3.1.1/base/gmlBase.xsd */
DBMS_XMLSCHEMA.registerSchema(
schemaURL => 'http://www.opengis.net/gml/3.1.1/base/dictionary.xsd',
schemaDOC => XDBURIType('/public/tempspaceforschema/diggs/gml/3.1.1/base/dictionary.xsd').getClob(),
Local => TRUE,
gentypes => TRUE,
gentables => FALSE
);
end;
/* Fails on error:

ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00172: "DefinitionType" is not a valid restriction of "AbstractGMLType"
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 20
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 31
ORA-06512: at line 4
*/

/* The below also fails... */

begin
/* imports gmlbase */
/* for gmlbase use: http://www.opengis.net/gml/3.1.1/base/gmlBase.xsd */
DBMS_XMLSCHEMA.registerSchema(
schemaURL => 'http://www.opengis.net/gml/3.1.1/base/dictionary.xsd',
schemaDOC => XDBURIType('/public/tempspaceforschema/diggs/gml/3.1.1/base/dictionary.xsd').getClob(),
Local => TRUE,
gentypes => FALSE,
gentables => FALSE
);
end;


James
Tagged:

Answers

  • Marco Gralike
    Marco Gralike Member Posts: 4,491 Silver Trophy
    Because you didn't get an response here, yet, accoording to the general XML Thread, I will give it a try ;-)

    XLink is supported in 11gR1 (did you try that version as well?)

    XML Schemata have to be registered in the XMLDB repository, if you want to refer to it (include, import), so also the "official" ones have to be registered by Oracle or you. Most of them are already preregistered in the repository. AFAIK / remember, xlink is default in Oracle 11gR1 (not in pre 11gR1 releases).

    Refering to cyclic dependancies between Schemata the Oracle 11gR1 XMLDB Development Guide states
    Example 8–23 Cyclic Dependencies
    
    An XML schema that includes another XML schema cannot be created if the included
    XML schema does not exist.
    
    
    BEGIN DBMS_XMLSCHEMA.registerSchema('xm40.xsd','<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:my="xm40" targetNamespace="xm40">
    <include schemaLocation="xm40a.xsd"/>
    <!-- Define a global complextype here -->
     <complexType name="Company">
      <sequence>
       <element name="Name" type="string"/>
       <element name="Address" type="string"/>
      </sequence>
     </complexType>
    <!-- Define a global element depending on included schema -->
      <element name="Emp" type="my:Employee"/>
    </schema>',
    TRUE,
    TRUE,
    FALSE,
    TRUE);
    END;
    /
    
    It can, however, be created with the FORCE => TRUE option (the last argument):
    
    BEGIN DBMS_XMLSCHEMA.registerSchema('xm40.xsd','<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:my="xm40" targetNamespace="xm40">
    <include schemaLocation="xm40a.xsd"/>
    <!-- Define a global complextype here -->
     <complexType name="Company">
      <sequence>
       <element name="Name" type="string"/>
       <element name="Address" type="string"/>
      </sequence>
     </complexType>
    <!-- Define a global element depending on included schema -->
      <element name="Emp" type="my:Employee"/>
    </schema>',
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    TRUE);
    END;
    /
    
    Attempts to use this schema and recompile will fail:
    
    CREATE TABLE foo OF XMLType XMLSCHEMA "xm40.xsd" ELEMENT "Emp";
    
    Now, create the second XML schema with the FORCE option. This should also make the first XML schema valid:
    
    BEGIN DBMS_XMLSCHEMA.registerSchema('xm40a.xsd','<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:my="xm40" targetNamespace="xm40">
    <include schemaLocation="xm40.xsd"/>
    <!-- Define a global complextype here -->
     <complexType name="Employee">
      <sequence>
       <element name="Name" type="string"/>
       <element name="Age" type="positiveInteger"/>
       <element name="Phone" type="string"/>
      </sequence>
     </complexType>
    <!-- Define a global element depending on included schema -->
      <element name="Comp" type="my:Company"/>
    </schema>',
    TRUE,
    TRUE,
    FALSE,
    TRUE,
    TRUE);
    END;
    /
This discussion has been closed.