cookiejar
asked on
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
Thank you. See the attachments.
contacts.txt
contacts.xml
<!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)>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
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.