Document type definition (DTD) is a basic form of data definition. It supports only string data types. The XML PDS can take a URL to a local or remote DTD as data definition.
The XML PDS expects the DTD to be in this format:
<!ELEMENT tableName (rowName)*>
<!ELEMENT rowName (columnName1?,columnName2?,...,columnNameN?)>
<!ELEMENT columnName1 (CDATA)>
<!ELEMENT columnName2 (CDATA)>
...
<!ELEMENT columnNameN (CDATA)>
As shown above, the tableName
,
rowName
, and columnNameX
can be any valid XML element name. Elements of columnName1
,
columnName2
, and so on are described
as data items of type string.
If your DTD is more complicated, then you can write your own DTD translator and convert it to the above required format.
You can additionally have an XSL transformation file to convert complex XML file to the required format of XML PDS.
The following DTD conforms to the required format:
<!ELEMENT Company (Department*)>
<!ELEMENT Department (Deptno, Dname,Loc)>
<!ELEMENT Deptno (#PCDATA)>
<!ELEMENT Dname (#PCDATA)>
<!ELEMENT Loc (#PCDATA)>
This DTD can either be referred to in the XML data file (external DTD) or included in the XML data file itself (inline DTD).
Following is an XML data file that adheres to the data definition format described above:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE TABLE1 SYSTEM "dept_dtd.dtd">
<Company>
<Department>
<Deptno>1000</Deptno>
<Dname>RESEARCH</Dname>
<Loc>NEWYORK</Loc>
</Department>
<Department>
<Deptno>1001</Deptno>
<Dname>RESEARCH</Dname>
<Loc>DALLAS</Loc>
</Department>
<Department>
<Deptno>1002</Deptno>
<Dname>DEVLOPMENT</Dname>
<Loc>DALLAS</Loc>
</Department>
</Company>
Copyright © 1984, 2005, Oracle. All rights reserved.