post #1 of 1
Thread Starter 
I need help getting my XML document to validate. I wrote my own DTD so I am building the XML document from that DTD.

The DTD is based on the folowing
Quote:
Create a DTD for courses in a university. Each course element should have child elements department, course_name, course_number, instructor, course_type, time, and room. The course_type element must have attributes lab and lecture, each of which may have values true or false.


DTD FILE
Code:
<!ELEMENT courses (department, course_name, course_number, instructor, course_type, time,room)>
<!ELEMENT department (#PCDATA)>
<!ELEMENT course_name (#PCDATA)>
<!ELEMENT course_number (#PCDATA)>
<!ELEMENT instructor (#PCDATA)>
<!ELEMENT course_type (lab,lecture)> 
<!ELEMENT time (#PCDATA)> 
<!ELEMENT room (#PCDATA)> 
<!ATTLIST course_type lab CDATA "true | false">
<!ATTLIST course_type lecture CDATA "true | false">


XML FILE
Code:
<?xml version="1.0" encoding="UTF-8" ?>
     <!DOCTYPE courses SYSTEM "http://##########/~########### >


<courses>

<department>Computer Science</department>
<course_name>Programming I</course_name>
<course_number>CS 3332</course_number>
<instructor>Vande Van</instructor>
<course_type> </course_type> //VALIDATOR POINTS OUT ERROR HERE
<time>1pm</time>
<room>J-256</room>

<department>Computer Science</department>
<course_name>Programming II</course_name>
<course_number>CS 3333</course_number>
<instructor> Maxwell</instructor>
<course_type> </course_type> //VALIDATOR POINTS OUT ERROR HERE
<time>3pm</time>
<room>J-260</room>

<department>Information Technology</department>
<course_name>Web Development</course_name>
<course_number>IT 3203</course_number>
<instructor> Brown</instructor>
<course_type></course_type> //VALIDATOR POINTS OUT ERROR HERE
<time>3pm</time>
<room>J-210</room>
</courses>

The area where the validator is giving an error, i left it empty on purpose


342

Here is a validator
Edited by Jamar16 - 3/29/12 at 10:22pm