Question

This is a continuation question to my previous question.

I have XML files and XML Schema provided by several different third parties. For some mysterious reasons Oracle requires an Oracle specific annotation to be able to validate xs:dateTime with timezone information correctly.

After lengthy debates with Google I've found out that I could add Oracle required annotation non-intrusively (i.e without modifying the original XML Schema) by using XML Schema redefine.

XML Schema provided by third party is conseptually like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:simpleType name="ISODateTime">
    <xs:restriction base="xs:dateTime"/>
  </xs:simpleType>

</xs:schema>

And I could bring in the annotation this way with redefine:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xdb="http://xmlns.oracle.com/xdb">

  <xs:redefine schemaLocation="standard-schema.xsd">

    <xs:simpleType name="ISODateTime">
      <xs:restriction base="xs:dateTime" xdb:SQLType="TIMESTAMP WITH TIME ZONE"/>
    </xs:simpleType>

  </xs:redefine>

</xs:schema>

Unfortunately according to Oracle documentation redefine is the single only XML Schema feature not supported by Oracle XML Database:

XML Schema Support

[...] Oracle XML DB supports all of the constructs defined by the XML Schema Recommendation, except for redefines.

(And my experiments support this statement.)

What options, if any, do I have to add the required xdb:SQLType annotation without modifying the original XML Schema ?

I'm running Oracle Database 11g Release 11.2.0.4.0.

Was it helpful?

Solution

Define a simple XSLT transformation that adds the annotation, and run it whenever you need to generate the Oracle schema from the third-party schema.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top