130 likes | 288 Views
XML Basics. Hope Greenberg Center for Teaching & Learning. XML: What, Why, When and How. What is HTML?. A set of markup tags for encoding elements of web documents. E ncoding is the addition of codes to text in order to make it possible for a computer to process that text.
E N D
XML Basics Hope Greenberg Center for Teaching & Learning
XML: What, Why, When and How What is HTML? • A set of markup tags for encoding elements of web documents. • Encoding is the addition of codes to text in order to make it possible for a computer to process that text. • Interpretation of elements is built into a web browser, helped by CSS. • Presentational (sort of) not semantic. • Looks like: <p>Hello world.</p> <p class=“green”>Hello world.</p>
XML: What, Why, When and How What is XML? • A markup language for describing structured documents. • Allows for creation of elements based on need. • Designed to be semantic (meaning is separate from presentation). • Looks like: <p>Hello world.</p> • But can also look like: <para>Hello world.</para>
XML: What, Why, When and How What is the TEI? • Text Encoding Initiative founded in 1987. • Guidelines for encoding machine-readable texts in the humanities and social sciences. • Includes standardized ways to mark up a document’s semantics.
XML: What, Why, When and How Why use the TEI? • With HTML you could do this: <p>Enter KING.</p> <p>Queen.</p> <p> Alas, look here, my lord.</p> <p> Ophelia speaks </p> <p> Oph.</p> <p>Song.</p> <p>Larded all with sweet flowers,</p>
XML: What, Why, When and How Why use the TEI? • With CSS you could add some classification: <p.stage>Enter KING.</p> <p.speaker>Queen.</p> <p.speech> Alas, look here, my lord.</p> <p.stage> Ophelia speaks </p> • and then tell the CSS to make each class LOOK different.
XML: What, Why, When and How Why use the TEI? <stage>Enter KING.</stage> <sp who="Queen” type=“female”> <speaker >Queen.</speaker> <l n="37" part="Y"> Alas, look here, my lord.</l> </sp> <sp who="Oph” type=“female”> <speaker>Ophelia</speaker> <stage>Song. </stage> <l n="38"> Larded all with sweet flowers,</l>
XML: The Pieces XML: What, Why, When and How css web xhtml.xsl XML File print.xsl mobil.xsl Mobil device Schema/DTD Parser
XML: What, Why, When and How XML File: The Pieces • Declaration (what am I?) • Processing Instructions (what will you do with me?) • Elements (what am I made of?) • (tag, attributes, content: PCDATA) • Entities (what else do we need?) • Character, files, • Comments (secret messages) • CDATA (just like this or else…)
XML: What, Why, When and How XML File: The Pieces • Declaration <?xml version=“1.0” encoding=“UTF-16” standalone=“yes”> • Processing instruction <?xml-stylesheethref=“classic.xsl” type=“text/xml”?>
XML: What, Why, When and How XML File: The Pieces • Elements (tag, attributes, content: PCDATA) <p>Hello World!</p> <p type=“cliched”>Hello World!</p> • Entities • Character & & & • Text or other: external <!ENTITY lady SYSTEM “http://www.uvm.edu/~hag/lady.jpeg NDATA jpeg><figure entity=“lady”></figure>
XML: What, Why, When and How XML File: Some Rules • XML tags are case sensitive. • All XML elements must have a closing tag. • All XML elements must be properly nested. • All XML documents must have a root element. • Attribute values must always be quoted.