A script-enabled browser is required for this page to function properly.

About XML schema

XML schema supports more data types than a standard DTD. In addition to the string data types supported in DTD, it supports numeric and date data types.

Also, the structure of XML schema uses the XML-based Tag definition. The XML PDS can take a URL to a local or remote XML schema as data definition.

XML PDS expects the XML schema to be in the following format:


<xsd:element name="tableName" type="tableType"/>
  <xsd:complexType name="tableType">
    <xsd:sequence>
      <xsd:element name="rowName" minOccurs="0" maxOccurs="unbounded">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="columnName1" type="xsd:string"/>
            <xsd:element name="columnName2" type="xsd:decimal"/>
            <xsd:element name="columnName3" type="xsd:date"/>
            ...
            <xsd:element name="columnNameN" type="xsd:date"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

In the above example, tableName, tableType, rowName, columnNameX can be any valid XML schema element/type name. Elements of columnName1, columnName2, and so on, are described as data items of the given type.

Below is an example of XML schema that adheres to the required format. Refer to About XML schema mapping for the various schema data types supported and the mapping of XML schema data types to Oracle Reports data types.

<?xml version="1.0"?>
<schema xmlns='http://www.w3.org/1999/XMLSchema'>
  <element name="CompanyInfo" >
    <complexType>
      <sequence>
        <element name="Employee" minOccurs="0" maxOccurs="unbounded">
          <complexType>
            <sequence>
              <element name="Name" type="string"/>
              <element name="Birthdate" type="date"/>
              <element name="Age" type="integer"/>
              <element name="Dateofjoin" type="date"/>
              <element name="Address" type="string"/>
              <element name="PinNumber" type="integer"/>
              <element name="Phone" type="integer"/>
              <element name="Education" type="string"/>
              <element name="Passyear" type="year"/>
              <element name="Salary" type="double"/>
              <element name="Bonus" type="float"/>
            </sequence>
          </complexType>
        </element>
      </sequence>
    </complexType>
  </element>
</schema> 

The XML PDS supports some of the advanced functionalities of XML schema such as simple (custom) data types, format masks for date format, and maximum column length for strings.

Below is an example XML schema file with all the advanced schema features supported in XML PDS. It defines and uses the simple (custom) data types.

Note: stockDate defines a pattern for date as dd-MMM-yy, Transaction defines a pattern for datetime as MM-dd-yyyy hh:mm:ss, and stockID has a maxLength defined as 15.

<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
  <xsd:simpleType name='stockDate'>
    <xsd:restriction base='xsd:date'>
      <xsd:pattern value='dd-MMM-yy'/>
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:simpleType name='Transaction'>
    <xsd:restriction base='xsd:timeInstant'>
      <xsd:pattern value='MM-dd-yyyy hh:mm:ss'/>
    </xsd:restriction>
  </xsd:simpleType>
  <simpleType name='stockID'>
    <restriction base='xsd:string'>
      <maxLength value='15'/>
    </restriction>
  </simpleType>
  <xsd:element name="XML">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="G_STORE" minOccurs="0" maxOccurs="unbounded">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="STORE_NAME" type="stockID"/>
              <xsd:element name="CITY" type="xsd:string"/>
              <xsd:element name="REGION" type="xsd:string"/>
              <xsd:element name="TRANSACTION_START" type="stockDate"/>
              <xsd:element name="TRANSACTION_PHASE1" type="Transaction"/>
              <xsd:element name="TRANSACTION_PHASE2" type="Transaction"/>
              <xsd:element name="TRANSACTION_END" type="stockDate"/>
              <xsd:element name="SALES" type="xsd:integer"/>
              <xsd:element name="DESCRIPTION" type="xsd:string"/>
              <xsd:element name="SALES_ROW_COUNT" type="xsd:integer"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

If your schema is more complicated, then you can write your own schema translator and convert it to the above required format. You can additionally have an XSL transformation file to convert a complex XML file to the required format of XML PDS.

See also

About external XML schema

About inline XML schema

About XML schema mapping