Generate DTD 6

Question:

Generate DTD for the given XML document

<?xml version=”1.0″ encoding=”UTF-8″?>

<!DOCTYPE  mobilestore  SYSTEM “mobile.dtd”>

<mobilestore>

<mobile>

<brand>Nokia</brand>

<os>Symbian</os>

<model>C6</model>

<ram>1gb</ram>

<internal>8gb</internal>

</mobile>

<mobile>

<brand>Samsung</brand>

<os>Android</os>

<model>Galaxy</model>

<ram>2gb</ram>

<internal>8gb</internal>

</mobile>

<mobile>

<brand>Sony</brand>

<os>Android</os>

<model>Experia</model>

<ram>512mb</ram>

<internal>16gb</internal>

</mobile>

</mobilestore>

Code:

mobile.dtd

<!ELEMENT mobilestore (mobile)+>
<!ATTLIST mobilestore
xmlns CDATA #FIXED ''>

<!ELEMENT mobile (brand,os,model,ram,internal)>
<!ATTLIST mobile
xmlns CDATA #FIXED ''>

<!ELEMENT brand (#PCDATA)>
<!ATTLIST brand
xmlns CDATA #FIXED ''>

<!ELEMENT os (#PCDATA)>
<!ATTLIST os 
xmlns CDATA #FIXED ''>

<!ELEMENT model (#PCDATA)>
<!ATTLIST model
xmlns CDATA #FIXED ''>

<!ELEMENT ram (#PCDATA)>
<!ATTLIST ram
xmlns CDATA #FIXED ''>

<!ELEMENT internal (#PCDATA)>
<!ATTLIST internal
xmlns CDATA #FIXED ''>

Recommended:

Leave a Comment

Your email address will not be published. Required fields are marked *

x