Lecture 11b: XML and Markup Languages

What You Will Learn Today

  1. Compare markup languages.
  2. Create document type definitions.
  3. Create XML DTDs and documents.
  4. Convert HTML documents to XHTML format.

Markup Languages

Document Type Definitions (DTDs)


XML Example

Create your own book DTD.

<!ELEMENT book (author, title, publisher, year)>
<!ELEMENT author (lastname, firstname, middlename?)>
<!ELEMENT lastname (#PCDATA)>
<!ELEMENT firstname (#PCDATA)>
<!ELEMENT middlename (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT year length CDATA "4">

Use your book DTD to mark up book documents.

<?xml version="1.0" encoding="UTF-8"?>

  <title>Internet Literacy</title>
  <publisher>McGraw Hill</publisher>


Converting from HTML to XHTML

To Do After Class