DTD - how to define attritbutes and two child elements

I have an XML file with two child elements to the root but I am getting a null error for the second child element.  It is also expecting definition for the attributes, could you show how this is done?

Thank you.  See the attachments.
contacts.txt
contacts.xml
cookiejarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BullockQA Engineer IIICommented:
I used this tool http://www.xmlvalidation.com/
with your input files.

It reported these errors.
Attribute "favcolor" must be declared for element type "family".
Attribute "gender" must be declared for element type "family".
Element type "friend" must be declared.
0
Geert BormansInformation ArchitectCommented:
<!ELEMENT contacts (family|friend)+>
<!ELEMENT friend (name,address,city,state,zip_code,phone,birthday?)>
<!ELEMENT family (name,address,city,state,zip_code,phone,birthday?)>
<!ATTLIST friend
gender CDATA #IMPLIED
favcolor CDATA #IMPLIED 
>
<!ATTLIST family
gender CDATA #IMPLIED
favcolor CDATA #IMPLIED 
>
<!ELEMENT name (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT state (#PCDATA)>
<!ELEMENT zip_code (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
<!ELEMENT birthday (#PCDATA)>

Open in new window

0
Geert BormansInformation ArchitectCommented:
I added an element "friend" having the same content model as "family"

For attributes you need an <!ATTLIST
first component is the name of the element the attribute is for
then a list of attribute declaration three components each: name, content type, required or not
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Geert BormansInformation ArchitectCommented:
You say this is an assignment, but you are obviously missing the basics.
Please read the course material before jumping right in the task,
it would help you understand what is going on

or start here
http://www.w3schools.com/dtd/default.asp
it is not a good tutorial, but it gives you some syntax basics
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.

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.