DTD - invalid structure

I am totally new to XML and constructing its DTD.  I ran the DTD against the XML document and encounter this error:  The content of element type "member" must match "null".  

I have attached both files.  What am I doing wrong?
contactinfo.xml
senators.txt
cookiejarAsked:
Who is Participating?
 
Geert BormansInformation ArchitectCommented:
you have two declarations for member, one being #PCDATA, drop that one
also your DTD only allows one member

Change your DTD like this

<!ELEMENT contact_information (member)+>
<!ELEMENT member (member_full,last_name,first_name,party,state)>
<!ELEMENT member_full (#PCDATA)>
<!ELEMENT last_name (#PCDATA)>
<!ELEMENT first_name (#PCDATA)>
<!ELEMENT party (#PCDATA)>
<!ELEMENT state (#PCDATA)>

Open in new window

0
 
cookiejarAuthor Commented:
Thank you for help.  When you say my DTD allows only one member.  Does that mean, the element member or one possible content for member?

For example, I have:

<member>

</member>
<member>

<member>

Isn't that more than one member, please forgive my ignorance, I am student and have not grasped this concept.
0
 
Geert BormansInformation ArchitectCommented:
OK, my explanation might have been a bit vague

Your DTD had
<!ELEMENT contact_information (member)>
which means that the element contact_information requires exactly one member child

I corrected like this
<!ELEMENT contact_information (member)+>
the "+" means "one or more"
with that correction contact_information can have more member child elements
0
 
cookiejarAuthor Commented:
Another question would it be correct to use <!ELEMENT contact_information (member)*>?
0
 
Geert BormansInformation ArchitectCommented:
yes, "*" means "zero or more"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.