this is getting to my brain so i have a XML doc that has a node called family
<family>
<parents>
<name>Bob</name>
<init>R</init>
<surname>Johnson</surename>
</parents>
<kids>
<name>Lucy</name>
<surname>Johnson</surname>
</kids>
</family>
the inital is optional so i create the DTD for this it ends up looking like
<!ELEMENT parent (name, initial?, surname)>
<!ELEMENT kid (name, initial?, surname)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT initial (#PCDATA)>
<!ELEMENT surname (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT initial (#PCDATA)>
<!ELEMENT surname (#PCDATA)>
but i keep getting this error validity error : Redefinition of element name ^ /tmp/tmp.dtd:26: validity error : Redefinition of element initial ^ /tmp/tmp.dtd:27: validity error : Redefinition of element surname ^
even if i change the DTD to look like this.
<!ELEMENT parent (name, initial?, surname)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT initial (#PCDATA)>
<!ELEMENT surname (#PCDATA)>
<!ELEMENT kid (name, initial?, surname)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT initial (#PCDATA)>
<!ELEMENT surname (#PCDATA)>
same error.. this is literally the second day i am using xml and from the tutorials i have read i cant seem to see what i am doing wrong..
You don’t need to declare the
name,initialandsurnametwice, just tryparentandkidshare the same definitions for their three (or two) child elements. Given an additional definition ofthis would validate the following (corrected from the document you included in the question)