130 likes | 227 Vues
Discover the fundamentals of XML, including rules, syntax, and essential tools. Learn how to create structured documents and manage data effectively with XML. Explore DTDs, schemas, and examples like TEI and EAD.
E N D
Introducing XML Maria Esteva DLSD General Libraries May 2004
XML • Rules to build a mark-up language • Open standard • Unicode • Preserves the purity of the content • It is human readable • Content and metadata • Facilitates storing, exchanging,managing,preserving data
XML basic components • Prolog <?xml version=“1.0”?> • Elements <note><message>the message</message></note> • Attributes <note type=“post-it” id=“21.2” n=“ 2” place=“upper left”>
XML syntax • Boundaries <note> </note> • Roles <name> </name> • Positions <title> </title> <p> </p> • Nesting <note> <salutation>Hello<name>Mark,</name></salutation> <message><p>I will see you tomorrow</p></message> <farewell>Bye and <emph>Good luck to you! <emph></farewell> <signature><name>Maria</name></signature> </note> • Relationships <xlinks> outside/inside the document <xpointers> inside the hierarchy of the document
XML rules • An element containing text or other elements must have start and end tags • An empty element’s tag must have a / before the end bracket <pb n=“100”/> • Nested elements may not overlap <note><message>this is the message</message> </note> • All attribute values must be in quotes <title type=“sub”>An Introduction</title>
XML tools • Editors and parsers • Cooktop FREE • Xmetal • Latest Microsoft Office • Web browsers • Internet Explorer • Mozilla • Opera • Style-sheets
Let’s try and mark-up! • Consider the structure of your text • Choose element names that make sense • Think about what you would like to have indexed for that piece
Something simple <?xml version="1.0"?> <Dialogue> <speaker> <name>Jo Anne:</name> </speaker> <line>I told you many times that I don’t want to move to <state>Arizona!</state> </line> <speaker> <Gendermale>Joseph:</Gendermale> </speaker> <line>But my dear, <emph>we will make a new life there…</emph> </line> <speaker>Jo Anne:</speaker> <line> <desperate>The weather in Phoenix is <emph>so</emph> dry, the humidity is always below <percentage>20%</percentage> </desperate> </l> </Dialogue>
Why DTDs and schemas? Define rules to produce similarly structured documents • DTD: Defines structure elements and attributes of xml documents • Schema: Successor of the DTD,defines structure, content, and semantics of xml documents
XML et al.. • Prolog <?xml version=“1.0”?> • Namespaces <DC xmlns:dc=http://purl.org/dc/elements/1.1/> • Notations <!NOTATION JPEG PUBLIC 'ISO DIS 10918//NOTATION JPEG Graphics Format//EN'> • Entities <!ENTITY author-b-003-f SYSTEM “author-b-003-f.jpg" NDATA JPG> <!ENTITY author “Jonas Smith”> <body><p> &author decided to write using the point of view of a child. While &author was not convinced of the ……</p></body>
Some examples • TEI • EAD • BUILDING your own DTDs / results • METS
DTDs and schemas at DLSD • TEI Text Encoding Initiative • Header • Content • MODSMetadata Object Description Schema • DCDublin Core • EADEncoding Archival Description • MIXMetadata for Images in XML Schema • METSMetadata Encoding and Transmission Standard
XML the end Bibliography Ray, E. (2001).Learning XML. O’ Reilly Acknowledgments Jennifer Lee Loretta Acevedo Aaron Choate Uri Kolodney