XML Basics, Part 1

2008-09-23

Tyng-Ruey Chuang
trc@iis.sinica.edu.tw

Institute of Information Science
Academia Sinica, Taipei, Taiwan

Lecture Outline

The Structure of An XML Document

The Text in An XML Document

Entity References and Character References

(General) Entity references (for example):

(Numeric) Character references (for example):

More Markup

Comments (for example):

<!-- declarations for <head> & <body> --> 

CDATA sections (for example):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
             "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
	<!ATTLIST polygon
		area CDATA #IMPLIED
		circumference CDATA #IMPLIED>
]>
<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
  <defs>
		<style type="text/css"><![CDATA[
		polygon { fill: green;    stroke: black;  stroke-width: 1}
		]]>
		</style>
  </defs>
  <polygon id="_10001001" points="10,10 10,90 90,90 90,10" area="6400" circumference="320"/>
</svg>

Processing instructions (for example):

<?xml-stylesheet href="person.css" type="text/css"?>

Document Type Declarations

A valid document includes a document type declaration that identifies the DTD (Document Type Definition) that the document satisfies. A DTD contains or points to the following kinds of markup declarations.

Attribute-List Declaration

Attribute-List Declaration (Cont.)

Attribute-List Declaration (Cont.)

External/Internal DTDs

Well-formedness and Validity