archives hub workshop 2011 An Introduction to XML
XML <ul><li>e X tensible  M arkup  L anguage  </li></ul><ul><li>Define XML </li></ul><ul><li>XML syntax and rules  </li></...
What is XML? <ul><li>XML is a grammatical system for creating languages… a  meta - language   </li></ul><ul><li>Use XML to...
What is interoperability? <ul><li>the ability to exchange/share data </li></ul><ul><li>provides advantages of cross-search...
Something to remember about XML <ul><li>XML  does not do anything itself . It is pure information wrapped in XML tags.  </...
XML: elements <language>  English  </language> <tag> </tag> content
XML attributes <ul><li>Attributes are simple name/value pairs associated with an element </li></ul><ul><li><tag  attribute...
XML and Content <ul><li>XML is essentially about  structure . It focuses on what the data is </li></ul><ul><li>The structu...
Sample Content <ul><li>Papers of John Ruskin </li></ul><ul><li>1864-1888 </li></ul><ul><li>10 boxes </li></ul><ul><li>Held...
Table Title Papers of John Ruskin Dates 1864-1888 Extent 10 boxes Held At University of London Library
XML: Structure <ul><li><catalog> </li></ul><ul><li>< title >Papers of John Ruskin</ title > </li></ul><ul><li>< date >1864...
Well-formed XML <ul><li>a root element is required </li></ul><ul><li><catalog>  all content  </catalog> </li></ul><ul><li>...
<ul><li>Create tags for your data </li></ul>Hands-On
Valid XML (1) <ul><li>Valid XML:  rules  specify elements and attributes & how they are used </li></ul><ul><li>Valid XML p...
Valid XML (2) <ul><li>Must conform to a Document Type Definition (DTD) or Schema </li></ul><ul><ul><li>Archives: Encoded A...
DTDs/Schemas <ul><li>A   Document Type Definition  or  Schema  define s  the building blocks of an XML document </li></ul>...
Schemas <ul><li>Schemas perform the same task as DTDs </li></ul><ul><li>Schemas use XML syntax </li></ul><ul><li>Schemas s...
A simple XML document <ul><li><?xml version=&quot;1.0&quot;?>  </li></ul><ul><li><note>  </li></ul><ul><li><to>Rachel</to>...
Example of a simple Schema <ul><li><?xml version=&quot;1.0&quot;?>  </li></ul><ul><li><xs:schema xmlns:xs=&quot;http://www...
What about display? XML file DTD or Schema Valid XML Blue Elephant Papers …………………… ………… Blue Elephant Papers Browse List
Displaying XML <ul><li>XML technologies – for displaying, retrieving, transforming, manipulating </li></ul><ul><li>DOM, SA...
 
 
Transformation of XML <ul><li>Transformation involves the reading in of an XML file and an XSLT file to a processor,which ...
HTML vs. XML <ul><li>HTML is ONLY for display, typically in a Web browser </li></ul><ul><li>Browsers display XML but not n...
Why use XML? <ul><li>International standard, supported by the W3C </li></ul><ul><li>The most common means to transmit data...
More reasons to use XML <ul><li>Separation of content and presentation </li></ul><ul><ul><li>With proprietary systems cont...
..and hierarchy <ul><li>Hierarchical structure </li></ul><collection> <part> <item> One item </item> </part> </collection>
… as well as sharing data <ul><li>XML is the main basis for defining data exchange languages  </li></ul><ul><li>Meaningful...
Summary <ul><li>XML must be well-formed and valid </li></ul><ul><li>DTDs and Schemas provide tags, attributes and rules </...
Upcoming SlideShare
Loading in …5
×

Intro XML for archivists (2011)

1,671 views

Published on

A short introduction to XML (intended to be used as part of a course on EAD (XML for archives).

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,671
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
35
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Contents of this section
  • Can be helpful when thinking about using XML to remember that it is just a means to mark up content. You then need to do stuff with the content – there are plenty of tools out there for this.
  • XML syntax is quite straightforward – elements are commonly just content wrapped in opening and closing tags.
  • Attributes enable you to add further information to refine your basic tagged content. Think of the language, for example, as the basic content; the attribute adds information about the encoded version (standards compliant code). The normal attribute in archives is used for date searching – meaning ‘ normalised ’ date.
  • XML rules can introduce some information about content, but you should think of XML primarily as a means to structure data.
  • Here is a very simple sample record.
  • This is the sample data wrapped in tags so that each part of the content is given meaning so that it is easier to machine process. E.g. search just for &lt;title&gt; content, or display just &lt;title&gt; and &lt;date&gt; content.
  • Well-formed applies to XML generally; ‘Valid’ applies to XML conforming to the specific rules you are following – in our case for EAD.
  • There are DTDs or Schemas for a huge range of data types.
  • Many archivists using EAD still use the DTD. Moving to the schema is not entirely straightforward.
  • The note element is said to be of a complex type because it contains other elements. The other elements (to, from, heading, body) are said to be simple types because they do not contain other elements. Rather than defining the data type ‘ string ’ you could have a date or time or integer.
  • Archivists generally don’t need to concern themselves with the more technical aspects of XML tools, although it can be useful to have some idea of what you can do. The DOM (an API) represents a tree view of an XML document - a programmer can create an XML document, navigate its structure, and add, modify, or delete its elements. the objective for the XML DOM has been to provide a standard programming interface to a wide variety of applications. SAX (an API) is also an option for analysing and extracting information XForms use XML to create forms on the Web Xlink, Xpointer – ability to link XML documents API - The interface (calling convention) by which an application program accesses a service
  • Once you have XML, you can use a stylesheet (XSLT) to create (X)HTMLoutput to display your description in a browser. You can also output other formats, such as PDF or text.
  • Some people get confused between HTML and XML. HTML is for display of data – it is not readily machine processable because it does not mark data up in meaningful ways, e.g. it does not identify the title, date, extent, access conditions, etc. XML does not carry information about how to display it. Remember, the tags are invented by the author.
  • Intro XML for archivists (2011)

    1. 1. archives hub workshop 2011 An Introduction to XML
    2. 2. XML <ul><li>e X tensible M arkup L anguage </li></ul><ul><li>Define XML </li></ul><ul><li>XML syntax and rules </li></ul><ul><li>XML DTDs and Schemas </li></ul><ul><li>Displaying XML </li></ul><ul><li>Why use XML? </li></ul>
    3. 3. What is XML? <ul><li>XML is a grammatical system for creating languages… a meta - language </li></ul><ul><li>Use XML to design your own markup language , consisting of meaningful tags that describe the data they contain </li></ul><ul><li>Create a language for describing a nything: archives, books, government services, properties… </li></ul>
    4. 4. What is interoperability? <ul><li>the ability to exchange/share data </li></ul><ul><li>provides advantages of cross-searching, so user can easily search across and retrieve resources from a variety of different systems </li></ul><ul><li>allows users to move beyond individual websites for individual resources </li></ul><ul><li>integrates information resources presented in different formats </li></ul><ul><li>XML facilitates interoperability </li></ul>
    5. 5. Something to remember about XML <ul><li>XML does not do anything itself . It is pure information wrapped in XML tags. </li></ul><ul><li>You must use other means to send, receive or display the data </li></ul>XML XML technologies is used by to create Detailed description to view in a browser Summary entry to view in a browser PDF for print
    6. 6. XML: elements <language> English </language> <tag> </tag> content
    7. 7. XML attributes <ul><li>Attributes are simple name/value pairs associated with an element </li></ul><ul><li><tag attribute_name= “ attribute_value ” >content</tag> </li></ul><ul><li><language …………….. >English<language> </li></ul><ul><li><language langcode= “ eng ” >English</language> </li></ul><ul><li><date>20 Sept 2004</date> </li></ul><ul><li><date normal= “ 2004 ” >20 Sept 2004</date> </li></ul>
    8. 8. XML and Content <ul><li>XML is essentially about structure . It focuses on what the data is </li></ul><ul><li>The structure enables content to be identified by machines so they can process the data </li></ul><ul><li>XML is not primarily about content, though there might be some restrictions on content </li></ul>
    9. 9. Sample Content <ul><li>Papers of John Ruskin </li></ul><ul><li>1864-1888 </li></ul><ul><li>10 boxes </li></ul><ul><li>Held at the University of London Library </li></ul>
    10. 10. Table Title Papers of John Ruskin Dates 1864-1888 Extent 10 boxes Held At University of London Library
    11. 11. XML: Structure <ul><li><catalog> </li></ul><ul><li>< title >Papers of John Ruskin</ title > </li></ul><ul><li>< date >1864-1888</ date > </li></ul><ul><li>< extent >10 boxes</ extent > </li></ul><ul><li>< location >University of London Library</ location > </li></ul><ul><li></catalog> </li></ul>
    12. 12. Well-formed XML <ul><li>a root element is required </li></ul><ul><li><catalog> all content </catalog> </li></ul><ul><li>closing tags are required </li></ul><ul><li>elements must be properly nested </li></ul><ul><li>case must be consistent </li></ul><ul><li>attribute values must be in quotation marks </li></ul>
    13. 13. <ul><li>Create tags for your data </li></ul>Hands-On
    14. 14. Valid XML (1) <ul><li>Valid XML: rules specify elements and attributes & how they are used </li></ul><ul><li>Valid XML provides consistency and facilitates the exchange of data </li></ul><ul><li>Valid XML is important for displaying, processing and exchanging XML in a wider environment </li></ul>
    15. 15. Valid XML (2) <ul><li>Must conform to a Document Type Definition (DTD) or Schema </li></ul><ul><ul><li>Archives: Encoded Archival Description - EAD version 1; EAD 2002 </li></ul></ul><ul><ul><li>e-learning: IEEE Learning Object Metadata Schema (LOM) </li></ul></ul><ul><ul><li>Government: Council Roadworks Schema </li></ul></ul>
    16. 16. DTDs/Schemas <ul><li>A Document Type Definition or Schema define s the building blocks of an XML document </li></ul><ul><li>It specifies elements and attributes and defines how they can be used </li></ul><ul><li>P eople can agree to use a common DTD/schema for interchanging data </li></ul><ul><li>Usually point to an external DTD/schema from the XML document </li></ul>
    17. 17. Schemas <ul><li>Schemas perform the same task as DTDs </li></ul><ul><li>Schemas use XML syntax </li></ul><ul><li>Schemas support complex data types </li></ul><ul><li>Schemas are extensible </li></ul><ul><li>One XML document can point to more than one schema </li></ul>
    18. 18. A simple XML document <ul><li><?xml version=&quot;1.0&quot;?> </li></ul><ul><li><note> </li></ul><ul><li><to>Rachel</to> </li></ul><ul><li><from>John</from> </li></ul><ul><li><heading>Reminder</heading> </li></ul><ul><li><body>Don't forget the concert!</body> </li></ul><ul><li></note> </li></ul>
    19. 19. Example of a simple Schema <ul><li><?xml version=&quot;1.0&quot;?> </li></ul><ul><li><xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; targetNamespace=&quot;http://www.w3schools.com&quot; xmlns=&quot;http://www.w3schools.com&quot; elementFormDefault=&quot;qualified&quot;> </li></ul><ul><li><xs:element name=&quot;note&quot;> </li></ul><ul><li><xs:complexType> </li></ul><ul><li><xs:sequence> </li></ul><ul><li><xs:element name=&quot;to&quot; type=&quot;xs:string&quot;/> </li></ul><ul><li><xs:element name=&quot;from&quot; type=&quot;xs:string&quot;/> </li></ul><ul><li><xs:element name=&quot;heading&quot; type=&quot;xs:string&quot;/> </li></ul><ul><li><xs:element name=&quot;body&quot; type=&quot;xs:string&quot;/> </li></ul><ul><li></xs:sequence> </li></ul><ul><li></xs:complexType> </li></ul><ul><li></xs:element> </li></ul><ul><li></xs:schema> </li></ul>
    20. 20. What about display? XML file DTD or Schema Valid XML Blue Elephant Papers …………………… ………… Blue Elephant Papers Browse List
    21. 21. Displaying XML <ul><li>XML technologies – for displaying, retrieving, transforming, manipulating </li></ul><ul><li>DOM, SAX, XForms, XLink, XPointer </li></ul><ul><li>XSL FO – Extensible Stylesheet Language Formatting Objects </li></ul><ul><li>XSLT – Extensible Stylesheet Language for Transformations </li></ul><ul><li>CSS – a less sophisticated way to display XML </li></ul>
    22. 24. Transformation of XML <ul><li>Transformation involves the reading in of an XML file and an XSLT file to a processor,which can then generate some output – typically HTML </li></ul>XSLT XML processor HTML output
    23. 25. HTML vs. XML <ul><li>HTML is ONLY for display, typically in a Web browser </li></ul><ul><li>Browsers display XML but not necessarily as HTML </li></ul><ul><li>(http://www.w3schools.com/xml/simple.xml) </li></ul><ul><li>HTML tags do not describe the content </li></ul><ul><li>HTML cannot easily be extracted </li></ul><ul><li>Store the data separately as XML files and change the presentation with HTML </li></ul>
    24. 26. Why use XML? <ul><li>International standard, supported by the W3C </li></ul><ul><li>The most common means to transmit data </li></ul><ul><li>XML is open, licence free and platform neutral </li></ul><ul><li>XML is human and machine readable </li></ul><ul><li>XML documents are text documents: independent of hardware and software </li></ul>
    25. 27. More reasons to use XML <ul><li>Separation of content and presentation </li></ul><ul><ul><li>With proprietary systems content is inextricably bound up with format </li></ul></ul><ul><li>Use XSLT (Extensible Style Sheet Language for Transformations) to present XML data </li></ul><ul><li>Flexibility to manipulate and customise </li></ul>
    26. 28. ..and hierarchy <ul><li>Hierarchical structure </li></ul><collection> <part> <item> One item </item> </part> </collection>
    27. 29. … as well as sharing data <ul><li>XML is the main basis for defining data exchange languages </li></ul><ul><li>Meaningful/consistent tags facilitate extraction </li></ul><ul><li>Different incompatible systems can access and use the same data </li></ul>
    28. 30. Summary <ul><li>XML must be well-formed and valid </li></ul><ul><li>DTDs and Schemas provide tags, attributes and rules </li></ul><ul><li>XML requires other XML technologies </li></ul><ul><li>XSLT can transform XML </li></ul><ul><li>XML is simple, flexible and great for data exchange </li></ul><ul><li>It is a more efficient way to a sustainable system </li></ul>

    ×