Ejercicio 411
Elabora un documento DTD que permita validar la estructura del siguiente documento XML:
<numeros>
<n1 letra="u" letra2="n" letra3="o">1</n1>
<n2 letra="d" letra2="o" letra3="s">22</n2>
<n6 letra="s" letra2="e" letra3="i" letra4="s">666666</n6>
</numeros>
Solución
XML
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE numeros SYSTEM "411.dtd">
<numeros>
<n1 letra="u" letra2="n" letra3="o">1</n1>
<n2 letra="d" letra2="o" letra3="s">22</n2>
<n6 letra="s" letra2="e" letra3="i" letra4="s">666666</n6>
</numeros>
411.dtd
<!ELEMENT numeros (n1, n2, n6)>
<!ELEMENT n1 (#PCDATA)>
<!ATTLIST n1 letra CDATA #REQUIRED>
<!ATTLIST n1 letra2 CDATA #REQUIRED>
<!ATTLIST n1 letra3 CDATA #REQUIRED>
<!ELEMENT n2 (#PCDATA)>
<!ATTLIST n2 letra CDATA #REQUIRED>
<!ATTLIST n2 letra2 CDATA #REQUIRED>
<!ATTLIST n2 letra3 CDATA #REQUIRED>
<!ELEMENT n6 (#PCDATA)>
<!ATTLIST n6 letra CDATA #REQUIRED>
<!ATTLIST n6 letra2 CDATA #REQUIRED>
<!ATTLIST n6 letra3 CDATA #REQUIRED>
<!ATTLIST n6 letra4 CDATA #REQUIRED>