Writing XML

Review Quiz

Tutorial
Home

What is
XML?

XML vs.
HTML

Writing
XML

Help
Psychologists?

Resources

1. What is a DTD?

A specific type of document generated by XML.
Another language derived from SGML.
An application that converts markup into an output structure.
A formal set of grammar which describes the markup available in any specific type of document

2. Which of the following statements is true?

All valid XML files must be well-formed.
All XML files must use a DTD.
All well-formed XML files must be valid.
Markup must always be formally defined.

3. Which of the following is well-formed XML?

<?XML version="1.0?">
<PATIENT><NAME>John Smith
<SEX>Male
<AGE>34
<COMPLAINT>Frequent headaches and hears voices
<HR/>


<?XML version="1.0?">
<PATIENT>
<NAME>John Smith</NAME>
<SEX>Male</SEX>
<AGE>34</AGE>
<COMPLAINT>Frequent headaches and hears voices</COMPLAINT>
</PATIENT>
<HR/>


<PATIENT>
<NAME>John Smith</NAME>
<SEX>Male</SEX>
<AGE>34</AGE>
<COMPLAINT>Frequent headaches and hears voices</COMPLAINT>
</PATIENT>
<HR>


<?XML version="1.0?">
<PATIENT></PATIENT>
<NAME>John Smith<SEX>
</NAME>Male</SEX>
<AGE>34</AGE>
<COMPLAINT>Frequent headaches and hears voices</COMPLAINT>
<HR>

4. True or False? Valid XML files can either have a DTD or be DTDless.

True
False

5. Which of the following is valid XML?

<?XML version="1.0?">
<!DOCTYPE patientinfo [
]>
<PATIENT>
<NAME>John Smith</NAME>
<SEX>Male</SEX>
<AGE>34</AGE>
<COMPLAINT>Frequent headaches and hears voices</COMPLAINT>
</PATIENT>
<HR/>


<?XML version="1.0?">
<!DOCTYPE patientinfo [
<!ELEMENT patient (name, sex, age, complaint)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT sex (#PCDATA)>
<!ELEMENT age (#PCDATA)>
<!ELEMENT complaint (#PCDATA)>
<!ELEMENT hr EMPTY>
]>
<PATIENT>
<NAME>John Smith</NAME>
<SEX>Male</SEX>
<AGE>34</AGE>
<COMPLAINT>Frequent headaches and hears voices</COMPLAINT>
</PATIENT>
<HR/>


<?XML version="1.0?">
<!DOCTYPE patientinfo [
<!ELEMENT patient>
<!ELEMENT name>
<!ELEMENT sex>
<!ELEMENT age>
<!ELEMENT complaint>
<!ELEMENT hr>
]>
<PATIENT>
<NAME>John Smith</NAME>
<SEX>Male</SEX>
<AGE>34</AGE>
<COMPLAINT>Frequent headaches and hears voices</COMPLAINT>
</PATIENT>
<HR/>


<?XML version="1.0?">
<PATIENT>
<NAME>John Smith</NAME>
<SEX>Male</SEX>
<AGE>34</AGE>
<COMPLAINT>Frequent headaches and hears voices</COMPLAINT>
</PATIENT>
<HR/>

Help Psychologists?


Helen's Home Page | Helen's PSY 422 Page