Following is my problem statement:
XYZ school wants to store the details of student and staff in a xml file. The following scenario helps in designing the XML document.persons will be the root tag. persons will havethe entry of each person with name, age, gender, address. A person can be either a student or staff. Student will have rollno, standard and section. If staff, then staffid and subject. Every person must have an address with the following entry - doorno,street,city and state.
The code which I wrote is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE persons
[
<!ELEMENT name (#PCDATA)>
<!ELEMENT age (#PCDATA)>
<!ELEMENT gender (#PCDATA)>
<!ELEMENT address (doorno,street,city,state)>
<!ELEMENT student (rollno,standard,section)>
<!ELEMENT rollno (#PCDATA)>
<!ELEMENT standard (#PCDATA)>
<!ELEMENT section (#PCDATA)>
<!ELEMENT staff (staffid,subject)>
<!ELEMENT staffid (#PCDATA)>
<!ELEMENT subject (#PCDATA)>
<!ELEMENT doorno (#PCDATA)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT state (#PCDATA)>
]>
It gives the error- Exception:Premature end of file. I am quite new at XML and hence having a hard time. Help would be appreciated