i have this xml file but it doesnt want to recognise The "school" element that i have created, i defined it in the DTD but when i try and open it with MS-XML Notapad it gives me the following error:
PHP Code:
The element 'school' is used but not declared in the DTD/Schema.
<!ELEMENT account (personal)>
<!ELEMENT personal (name,lname,age,school)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT lname (#PCDATA)>
<!ELEMENT age (#PCDATA)>
<!ATTLIST school yr CDATA #REQUIRED
nm CDATA #REQUIRED>
Thr are some things that i noticed.
(1) U have used the school tag as an "Empty Tag". The attribute listing is only to pass values and nothing can be displayed unless they are placed within the open and close tags.
(2) Place the attribute listing as separate declarations:
Like this:
<!ATTLIST school yr CDATA #REQUIRED>
<!ATTLIST school nm CDATA #REQUIRED>
I haven't worked in XML b4. So if someone else can contribute here, i can learn too. Hope this helps.
sorry, i fixed it just after i posted this thread.
I totally forgot to declare the "School" element. this works:
<!ELEMENT personal (f:name,l:name,age,school)>
<!ELEMENT f:name (#PCDATA)>
<!ELEMENT l:name (#PCDATA)>
<!ELEMENT age (#PCDATA)>
<!ELEMENT school EMPTY>
<!ATTLIST school yr CDATA #REQUIRED
schl:name CDATA #REQUIRED>