Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTD help

Status
Not open for further replies.

araujo

Programmer
Dec 14, 2001
3
PT
Can anyone tell me how can i reference a DTD inside another DTD.

For example:

<!ELEMENT Person(name, age, Adress)>
<!ELEMENT name #PCDATA>
<!ELEMENT age #PCDATA>

and Adress should reference another DTD:

Adress.dtd

<!ELEMENT Adress ( .......) >

Thank's a lot

.david
 
First you have to import the DTD using:
[tt]
<!ENTITY % add SYSTEM &quot;address.dtd&quot;>
%add;
[/tt]
Then the first DTD will have access to the second DTD. For example:

[tt]
address.dtd:
<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
<!ELEMENT address (street, number)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT number (#PCDATA)>

people.xml:
<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
<!DOCTYPE people [
<!ELEMENT people (person+)>
<!ENTITY % add SYSTEM &quot;address.dtd&quot;>
%add;
<!ELEMENT person (name, age, address)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT age (#PCDATA)>
]>
<people>
<person>
<name>John Doe</name>
<age>19</age>
<address>
<street>Curch Street</street>
<number>21</number>
</address>
</person>
</people>
[/tt]

Cheers, Neil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top