i have been asked to create a simple dtd for this xml :
<?xml version='1.0' encoding='ISO-8859-1'?>
<QUERY>
<PORT>
<NB></NB>
</PORT>
<BLOCK>
<TAB></TAB>
</BLOCK>
<STAND>
<LEVEL></LEVEL>
</STAND>
</QUERY>
i am using java, i've never did dtd before nor do i know precisely what does it mean. i would like some guidance if its possible, thank you
DTD is Document Type Definition, and is used to represent the structure of you XML document. Other representations include XML Schema, Relax NG, etc.:
It will look something like the following (although my syntax may not be quite right):
<!ELEMENT QUERY (PORT, BLOCK, STAND)>
<!ELEMENT PORT (NB)>
<!ELEMENT NB (#PCDATA)>
<!ELEMENT BLOCK (TAB)>
<!ELEMENT TAB (#PCDATA)>
<!ELEMENT STAND (LEVEL)>
<!ELEMENT LEVEL (#PCDATA)>
If you look at the definition for QUERY you see it defines that it contains the elements: "PORT", "BLOCK", and "STAND". If you look at the definition for NB, we have declared that it should contain text (parsed character data).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With