Title: Introducing XML : Table of Contents
1Introducing XML Table of Contents
1. From HTML to XML 2. Well-Formed XML 3.
Validity / DTDs 4. Encodings 5. XML Namespaces 6.
XML Schema 7. XML Tools 8. XML APIs / SAX 9. XML
APIs / DOM 10. Stylesheets CSS XSL 11. XML
Query Language (XQL)
21. From HTML to XML
ltHTMLgt ltHEADgtltTITLEgtDrei Sonaten und drei
Partiten für Violine sololt/TITLEgtlt/HEADgt ltBODYgt ltH
1gtDrei Sonaten und drei Partiten für Violine
sololt/H1gt ltPgtPublisher Bärenreiterlt/Pgt ltPgtCompos
er J. S. Bachlt/Pgt lt?xml version"1.0"
encoding"ISO-8859-1"?gt lt!DOCTYPE music SYSTEM
"../DTDs/music.dtd"gt ltmusic ismn"M-006-46489-0"
type"concert"gt lttitlegtDrei Sonaten und drei
Partiten für Violine sololt/titlegt ltpublishergtBären
reiterlt/publishergt ltcomposergtJ. S.
Bachlt/composergt ...
32. Well-Formed XML
An XML document is called well-formed if 1. It
starts with the XML prolog, i.e. lt?xml
version1.0?gt ... 2. The tags are properly
nested, 3. There is exactly one root
element, ...
The XML spec http//www.w3.org/TR/REC-xml
43. Validity / DTDs
An XML document is valid, if it has an associated
document type declaration and if the document
complies with the constraints expressed in
it. lt!-- DTD for Music --gt lt!ELEMENT
music (title, publisher, composer?,
opus?, remarks?, instruments?, pieces)gt lt!ELEMENT
title (PCDATA)gt lt!ELEMENT
publisher (PCDATA)gt lt!ELEMENT composer
(PCDATA)gt lt!ATTLIST music ismn CDATA
IMPLIED ...
A Gentle Introduction to SGML
http//www-tei.uic.edu/orgs/tei/sgml/teip3sg/
54. Encodings
- lt?xml version"1.0" encoding"ISO-8859-1"?gt
- lt!DOCTYPE music SYSTEM "../DTDs/music.dtd"gt
- ltmusic ismn"M-006-46489-0" type"concert"gt
- lttitlegtDrei Sonaten und drei Partiten für Violine
sololt/titlegt - ltpublishergtBärenreiterlt/publishergt
-
- ISO-8859-1, western european, one byte per
character, superset of US-ASCII - UTF-8, at least one byte per character, superset
of US-ASCII - UTF-16, two bytes per character, endian problem
- UTF-32, four bytes per character, endian problem
Unicode Consortium Homepage http//www.unicode.o
rg/
65. XML Namespaces
XML namespaces provide a simple method for
qualifying element and attribute names used in
XML documents by associating them with namespaces
identified by URI references. ltlibrary
xmlnsmhttp//www.somewhere.com//gt ltmmusicgtltm
titlegt ltmmusicgtltmtitlegt ... lt/librarygt
W3C Rec., Namespaces in XML http//www.w3.org/T
R/REC-xml-names/
76. XML Schema
lt?xml version'1.0'?gt ltschema name'music'
version'1.0'gt ltelementType name'music'gt
ltsequencegt ltelementTypeRef name'title'/gt
ltelementTypeRef name'publisher'/gt
ltelementTypeRef name'composer' minOccur"0"
maxOccur"1"/gt ltattrDecl name'ismn'gt
ltdatatypeRef name'string'/gt lt/attrDeclgt ...
XML Schema Part 1 Structures
http//www.w3.org/TR/xmlschema-1/ XML Schema Part
2 Datatypes http//www.w3.org/TR/xmlschema-2/
87. XML Tools
XML Parsers expat, James Clark, C,
http//www.jclark.com/xml/expat.html XP, James
Clark, Java, http//www.jclark.com/xml/xp/ IE5 X
JParser, DataChannel, http//xdev.datachann
el.com/downloads/xjparser/ XML
Editors Notepad XMetaL, SoftQuad,
http//www.softquad.com/products/xmetal/index.h
tml Adept, Arbortext, http//www.arbortext.com/Pr
oducts/ ADEPT_Series/adept_series.html
98. XML APIs / SAX
SAX 1.0 a free API for event-based XML
parsing import org.xml.sax.Parser import
org.xml.sax.DocumentHandler import
org.xml.sax.helpers.ParserFactory Parser parser
ParserFactory.makeParser("com.microstar.xml.SAXD
river") DocumentHandler handler new
MyHandler() parser.setDocumentHandler(handler) p
arser.parse("http//pcjhb.software-ag.de/xml/close
dXml/instances/m1.xml") ... import
org.xml.sax.HandlerBase import
org.xml.sax.AttributeList public class MyHandler
extends HandlerBase public void startElement
(String name, AttributeList atts) ...
SAX Homepage http//www.megginson.com/SAX/
109. XML APIs / DOM
A platform- and language-neutral interface that
allows programs and scripts to dynamically access
and update the content, structure and style of
XML and HTML documents. import
org.w3c.dom. import com.docuverse.dom. DOM
dom new com.docuverse.dom.DOM() ... doc
dom.openDocument(url) BasicElement rootNode
(BasicElement) doc.getDocumentElement() NodeList
list rootNode.getChildNodes() Integer.toString(
list.getLength()) " Children") ...
DOM Level 1 Specification http//www.w3.org/TR/
REC-DOM-Level-1/
1110. Stylesheets
lt?xml version"1.0" encoding"ISO-8859-1"?gt lt?xml-
stylesheet type"text/xsl" href"music.xsl"?gt lt!DO
CTYPE music SYSTEM "music.dtd"gt ltmusic
ismn"M-006-46489-0" type"concert"gt ltxslstyle
sheet xmlnsxsl"http//www.w3.org/TR/WD-xsl"gt ...
ltxsltemplate match"music"gt
ltxslapply-templates select"opus"/gt ...
XSL spec http//www.w3.org/TR/WD-xsl/ The
W3Cs CSS Homepage http//www.w3.org/Style/CSS/
DSSSL Page at Mulberry Technologies
http//www.mulberrytech.com/dsssl/index.html
1211. XML Query Language (XQL)
The XML Query Language (XQL) is a query language
for XML using the structure of XML as its data
model. ltpiecesgt ltpiecegt lttitlegtSonata
Ilt/titlegt ltopusgtBWV 1001lt/opusgt ltmovementsgt ltmovem
entgtlttitlegtAdagiolt/titlegtlt/movementgt ltmovementgtltti
tlegtFuga Allegrolt/titlegtlt/movementgt ... //piece//m
ovementtitleAdagio
A W3C Proposal http//www.w3.org/TandS/QL/QL98/
pp/xql.html