Back to TIL list

DTD

Created at

O DTD por estar em um arquivo externo

howto.html

<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE howto SYSTEM "howto.dtd"> <howto>   <topic>       <title>Java</title>       <url>http://www.rgagnon.com/topics/java-xml.html</url>   </topic>     <topic>       <title>PowerBuilder</title>       <url>http://www.rgagnon.com/topics/pb-powerscript.htm</url>   </topic>   <topic>         <title>Javascript</title>         <url>http://www.rgagnon.com/topics/js-language.html</url>   </topic>   <topic>         <title>VBScript</title>         <url>http://www.rgagnon.com/topics/wsh-vbs.html</url>   </topic> </howto>

howto.dtd

 <!ELEMENT howto (topic*)>
 <!ELEMENT topic (title,url)>
 <!ELEMENT title (#PCDATA)>
 <!ELEMENT url (#PCDATA)>

O DTD pode estar dentro do XML

 <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE howto [   <!ELEMENT howto (topic*)>   <!ELEMENT topic (title,url)>   <!ELEMENT title (#PCDATA)>   <!ELEMENT url (#PCDATA)>   ]> <howto>   <topic>       <title>Java</title>       <url>http://www.rgagnon.com/topics/java-xml.html</url>   </topic> ... </howto>

Referências