company logo

ODABA XML Schema extension

Keywords:  schema

The XML schema for ODABA ODL definitions (OXML) is restricted to the data model definition. It is based on a standard XML schema definition, which uses the attribute extensions for elements to provide extended information required in the ODABA database model.

Structures in the the data model are defined as complex types in the schema. The structure properties and keys are defined as elements with additional attributes. Extents are defined as elements in the complex type DatabaseRoot. Enumerations can be provided as XML enumerations.

The intention of the OXML specification differs from the ODL schema definition, where the data type is the "leading concept". In an OXML schema, the extent or data collection is the leading concept, which then refers to the data type.

ODABA XML schema definitions can be used as dictionary to read from or write data to an XML file according to the dictionary structure. This provides a simple way of accessing XML data using ODABA access function. You may also run an ODABA application with an OXML dictionary and data stored in an OXML file, which might be funny, but not a proper solution for large databases.

The OXML schema extensions as being listed below are also available at www.odaba.com/OXMLBase.xsd. In addition, ODABA schema definitions include several attribute extensions.

Definition: 

    

<?xml version="1.0" encoding="ISO-8859-1"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>

<!-- The schema definition reflects the structure of the          -->

<!-- ODABA data model. This includes the data type and extent     -->

<!-- definitions.                                                 -->

<!-- Object data                                                  -->

<!--   Object data consists of one or more extents, which contain -->

<!--   the top elements, and an object space, which contains all  -->

<!--   exported objects and relationship to other or subordinated -->

<!--   objects. The object data type depends on the project       -->

<!--   extent definitions and is defined in the project specific  -->

<!--   part.                                                      -->

<!--    <xs:complexType name="Extents">                                                                         -->

<!--      <xs:sequence>                                                                                         -->

<!--        <xs:element name="Students" type="Collection" minOccurs="0" maxOccurs="1" dataType="Student"/>      -->

<!--        <xs:element name="Professors" type="Collection" minOccurs="0" maxOccurs="1" dataType="Professor"/>  -->

<!--           ....                                                                                             -->

<!--      </xs:sequence>                                                                                        -->

<!--    </xs:complexType>                                                                                       -->

<!-- The schema definition refers to generic types "Reference" and-->

<!-- "Collection". Thus, the type of the referenced objects is not-->

<!-- transparent in the schema definition, but this is defined    -->

<!-- in the element referring to the collection.                  -->

<!-- Generic type : Collection -->

  <xs:complexType name="Collection">

    <xs:sequence>

      <xs:element name="instance" type="Reference" minOccurs="0" maxOccurs="unbounded"/>

    </xs:sequence>

  </xs:complexType>

<!-- Generic type : Reference -->

  <xs:complexType name="Reference">

    <xs:attribute name="idref" type="xs:IDREF"/>

  </xs:complexType>

<!-- Common type : Object instance                                -->

<!--   The object instance type is a project specific choice type -->

<!--   that covers all existing structure types. It is defined in -->

<!--   the project specific part.                                 -->

<!--     <xs:complexType name="ObjectInstance">                   -->

<!--       <xs:choice>                                            -->

<!--         <xs:element name="oi_Student" type="Student"/>       -->

<!--         <xs:element name="oi_Professor" type="Professor"/>   -->

<!--             ....                                             -->

<!--       </xs:choice>                                           -->

<!--       <xs:attribute name="identity" type="xs:ID"/>           -->

<!--     </xs:complexType>                                        -->

<!-- The schema definition refers to common text types, which are -->

<!-- used to display multilingual texts (TextElement).            -->

<!-- General type : Text Element -->

  <xs:complexType name="TextElement">

    <xs:sequence>

      <xs:element name="text" type="LanguageText" minOccurs="0" maxOccurs="unbounded"/>

    </xs:sequence>

  </xs:complexType>

  <xs:complexType name="LanguageText">

    <xs:simpleContent>

      <xs:extension base="xs:string">

        <xs:attribute ref="xml:lang"/>

      </xs:extension>

    </xs:simpleContent>

  </xs:complexType>

</xs:schema>