1 / 51

XML

XML. Markup Languages.

Download Presentation

XML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML

  2. Markup Languages • A markup language is a formal way of annotating a document or collection of digital data using embedded encoding tags to indicate the structure of the document or data file, and the contents of its data elements. This markup provides a computer with information about how to process and display marked-up documents.

  3. What is XML? • XML is a grammatical system for creating languages… a meta-language • Use XML to design your own markup language, consisting of meaningful tags that describe the data they contain • Create a language for describing…anything

  4. SGML • Standard Generalized Markup Language, ISO (International Standards Organization) standard ISO/IEC 8879:1986, first used by the publishing industry, for defining, specifying, and creating digital documents that can be delivered, displayed, linked, and manipulated in a system-independent manner. • the parent of XML • an international standard for the description of marked-up electronic text • a metalanguage: a means of formally describing a language • XML is a subset of SGML • SGML is much more complex than XML

  5. HTML • HyperText Markup Language, an SGML-derived markup language used to create documents for World Wide Web applications. HTML emphasizes design and appearance rather than the representation of document structure and data elements.

  6. XML • A simplified subset of SGML that is designed specifically for use with the World Wide Web and that provides for more sophisticated data structuring and validation than HTML. XML is widely held to be the successor to HTML as the language of the Web.

  7. XML • What is XML? • EXtensible Markup Language. XML is a set of rules for defining markup languages and describing data. • Why XML? • XML is a standard means of delivering structured data via Web applications. • XML is extensible—both a blessing and a burden • Authors can define their own tags and attributes, e.g. CML Chemical markup language • You may hear someone from your IT department mention "well-formed" XML. A well-formed XML file conforms to a set of very strict rules that govern XML. If a file doesn't conform to those rules, XML stops working

  8. XML vs. HTML • HTML tells Web browsers how to display text, images, etc.— emphasis is on display • Unlike HTML, XML can “take database information with it”; emphasis is on structure, relationships, and ‘meaning’ • XML is a set of rules that are used to create markup languages while HTML is itself a markup language • Use HTML to describe the appearance of a document and XML to describe the structure

  9. XML vs. HTML • HTML defines only the appearance of your data — it's a pure display language. • XML describes the structure and meaning of your data. Using tags that describe the structure and meaning of your data makes it possible to reuse that data in any number of ways. For example, if you have a block of sales data, and each item in the block is clearly identified, you can load just the items that you need into a sales report and load other items into an accounting database. • HTML is limited to a predefined set of tags that all users share. • XML allows you to create any tag you need to describe your data and the structure of that data.

  10. Poetry Poem Stanza Verse Foot Caesura Monograph Title page Table of contents Chapters Sections Paragraphs Appendix Index Classes of Documents

  11. Types of Markup • Procedural • Display: font, italic, bold, etc. • Descriptive • Structural (document components) • Nominal e.g. <title> • Referential • Linking

  12. Descriptive Markup • Defines structural components of a class of documents • Defines relationships between data elements • Specifies frequency (repeatable, optional, mandatory) • Establishes the sequence of elements • Codified in a Document Type Definition (DTD) or an XML Schema • User-friendly documentation in a tag library

  13. Class of Documents Literary texts Archival inventories Web pages Electronic commerce Catalog records Cultural objects Hypertext documents Protocol TEI EAD Dublin Core BizTalk MARC CDWA/VRA Core HTML Document Type Definitions/Schemas

  14. Content Presentation Output MARC record ILS Software Browser Separating Markup and Display

  15. Content Presentation Output EAD document Stylesheet file Browser, Print Separating Markup and Display

  16. Characteristics of Encoding Standards • Class of documents • Identifiable set of common elements • Codification in a standard • MARC 21 standard • EAD DTD and Tag Library • Standards maintenance process

  17. Something to remember about XML • XML does not do anything itself. It is pure information wrapped in XML tags. • You must use other means to send, receive or display the data PDF for print Detailed description to view in a browser XML technologies is used by XML Summary entry to view in a browser To create

  18. XML Concepts • Document Type Definitions/Schemas • Defines document structure • Elements • Informational units • Attributes • Modify elements • Entities • External files • Style sheets • Prescribe presentation

  19. Elements (nouns) • Have start tags and end tags • <title>Moby Dick</title> • Have formal names and tag names • Formal name = paragraph • Tag name (generic identifier) = <p>

  20. Elements (nouns) • May contain text • PCDATA (parsable character data) • <title>Moby Dick</title • May be empty • <lb></lb> (line break) • XML syntax = <lb/> (empty element syntax)

  21. Elements (nouns) • May contain other elements • Wrappers • Nesting • Example: <date> <month>September</month> <day>12</day> <year>1958</year> </date>

  22. XML: elements <tag> content </tag> <language> English </language>

  23. Attributes (adjectives) • Modify the meaning of elements • <car>Honda</car> • Attributes of cars • Color • Year • Model • <car color=“green” model=“Civic” year=“1996”>Honda</car>

  24. XML attributes • Attributes are simple name/value pairs associated with an element <tag attribute_name=“attribute_value”>content</tag> <language>English</language> <language langcode=“eng”>English</language> <date normal=“20040920”>20 Sept 2004</date>

  25. Entities • A set of characters references as a unit • Special characters • Language keyboard • Character map: XML software • Character entity: $141; &amp • Non-text files (images, sound files) • External data files

  26. Style Sheets • Separate file • Controls presentation of data • Text format: font, size, color • Text layout: tabs, indents, line spacing, line breaks, tables • Can supply default text and images

  27. XML example <catalog> <cd> <title>OK Computer</title> <artist>Radiohead</artist> <type>pop</type> <year>1997</year> </cd> <cd> <title>Stanley Road</title> <artist>Paul Weller</artist> <type>pop</type> <year>1995</year> </cd> </catalog>

  28. XML must be well-formed • a root element is required <catalog> …..all your tags and content… </catalog> • closing tags are required

  29. XML must be well-formed (2) • elements must be properly nested <physdesc> <extent>10 boxes</extent> </physdesc> <physdesc> <extent>10 boxes</physdesc> </extent>

  30. XML must be well-formed (3) • case matters • attribute values must be enclosed in quotation marks, e.g. langcode=“fre” • element names must obey some basic rules, e.g. cannot start with numbers or punctuation characters, cannot contain spaces

  31. Valid XML • Valid XML: rules specify elements and attributes used and how used • Valid XML provides consistency and facilitates the exchange of data • Valid XML is important for displaying, processing and exchanging XML in a wider environment • Must conform to a Document Type Definition (DTD) or Schema • Archives: Encoded Archival Description - EAD version 1; EAD 2002

  32. Valid XML <ead> <archdesc level="fonds"> <did> <repository>John Rylands University Library of Manchester</repository> <unitid countrycode="GB" repositorycode="0133">GB 0133 NCN</unitid> <unittitle>Papers of Norman Nicholson</unittitle> <unitdate normal="1899/1987">1899-1987</unitdate> <physdesc><extent>0.44 cu.m; 1,201 items</extent></physdesc> <langmaterial> <language langcode="eng">English</language> </langmaterial> <origination>Nicholson, Norman Cornthwaite, 1914-1987</origination> <note>Created by the John Rylands Library archivist</note> </did> ……….. </archdesc> </ead>

  33. Document Type Definitions • ADocument Type Definitiondefines the building blocks of an XML document • It specifies elements and attributes and defines how they can be used • People can agree to use a common DTD for interchanging data • You can include a DTD in your XML source file, or point to an external DTD

  34. Schemas • Schemas perform the same task as DTDs • Schemas use XML syntax • Schemas support complex data types • Schemas are extensible • One XML document can point to more than one schema

  35. A simple XML document <?xml version="1.0"?> <note> <to>Rachel</to> <from>John</from> <heading>Reminder</heading> <body>Don't forget the concert!</body> </note>

  36. HTML vs. XML (1) • HTML is ONLY for display, typically in a Web browser • HTML tags do not describe the content • HTML cannot easily be extracted • HTML: <h1> Papers of Peter Rowe </h1> • XML: <title> Papers of Peter Rowe </title> • HTML: <b> 21 May 2004 </b> • XML: <date> 21 May 2004 </date>

  37. HTML vs. XML (2) • XML tags are self-describing • XML tags can be specified by anyone • XML is user and machine readable

  38. Why use XML? • Because everyone else is! • International standard, supported by the W3C • XML is open, licence free and platform neutral • XML is human and machine readable • XML documents are text documents

  39. More reasons to use XML • Separation of content and presentation • With proprietary systems content is inextricably bound up with format • XML does not determine the presentation of the data - You can use style sheets to present XML data

  40. ..and even more reasons • Hierarchical structure - XML documents are hierarchical in nature – with one top-level root element, and hence XML is an excellent choice for setting out hierarchical data in an easy-to-read fashion • The ability to manipulate and customise - data can be shaped and additions made as the author wishes

  41. and for data exchange • XML is the main basis for defining data exchange languages • Meaningful tags facilitate extraction – data can be manipulated as required • Text based - highly portable

  42. Summary • XML is simple, flexible and great for data exchange • XML must be well-formed and valid • DTDs and Schemas provide tags, attributes and rules • EAD is a DTD for archive descriptions

  43. A brief detour into metadata: Two ways to designate content In MARC: 245 04 $a The Big heat In XML: <title>Big heat</title> <name>value</name>

  44. In XML the name-value pair comprises an element An element has these parts: • Start tag • Element content • End tag <tag>content</tag> <subject>Goldfinches</subject>

  45. Element rules and features • Elements can hold data <pubPlace>Boston</pubPlace> • Elements can hold other elements ad infinitum <sourceDesc> <biblFull> <titleStmt> <title>A letter to Orestes A. Brownson</title> <author>Hildreth, Richard, 1807-1865.</author> </titleStmt> </biblFull> </sourceDesc> • Elements must be “properly” nested

  46. A quick look at other XML entities • Attributes qualify elements <notetype="500">Caption title.</note> • Document Type Definitions (DTDs) control the structure of XML documents <!ELEMENT note (#PCDATA)> <!ATTLIST note type CDATA #IMPLIED> • XML Schemas give more control than DTDs <xs:elementref="note" /> • Extensible Stylesheet Language Transformation (XSLT) stylesheets transform one XML document into another (or into HTML)

  47. What does XML allow us to do? • Structure data with a flexible and extensible set of rules • Share data in a non-proprietary format, especially among “incompatible” systems • Reuse data, e.g., in different presentation formats for different purposes

  48. Namespaces • A namespace identifies a specific set of elements • Namespaces allow metadata terms to be unambiguously used across applications • Defines what ‘Date’ or ‘Title’ means in a specific usage, or namespace • Each namespace has a unique identifier associated with it

  49. Namespaces - Example <dc:DC xmlns:dc='http://purl.org/dc/elements/1.1/'> <dc:title>Internet Ethics</dc:title> <dc:creator>Duncan Langford</dc:creator> <dc:format>Book</dc:format> <dc:identifier>ISBN 0333776267</dc:identifier>

  50. Namespaces - Example <d:student xmlns:s='http://www.develop.com/student' ' xmlns:w='urn:schemas.develop.com:workshop'> <s:id>3235329</s:id> <s:name>Jeff Smith</s:name> <w:name>Emerging Metadata Topics</w:name> <s:institution>XNL</s:institution> </d:student>

More Related