XML

Workshop

The Workshop is designed to help you anticipate possible questions, review what you've learned, and begin learning how to put your knowledge into practice. The answers to the quiz can be found following the quiz.

Quiz

1.

What is an empty element?

2.

What is the significance of the root element of a document?

3.

What is the XML declaration, and where must it appear?

4.

How would you code an empty element named movie with an attribute named format that is set to dvd?

Quiz Answers

1.

An empty element is an element that doesn't contain any content within its opening and closing tags. Empty elements can be coded as a pair of tags (<friend></friend>) or the more concise empty element tag (<friend />).

2.

The root element of a document contains all of the other elements in the document; every document must have exactly one root element.

3.

The XML declaration is a line of code at the beginning of an XML document that identifies the version of XML used by the document.

4.

<movie format="dvd" />

Exercises

1.

Add another trivia question to the talltales.xml document, complete with three possible answers, including which answer is the correct answer. Then view the document in a web browser using the talltales.css style sheet to see the new question.

2.

Modify the talltales.css style sheet so that the questions and answers are displayed in different colors. Hint: You can edit a style sheet in a text editor just as you edit an XML document.