Your SlideShare is downloading. ×
0
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Everything You Always Wanted To Know About XML But Were Afraid To Ask
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Everything You Always Wanted To Know About XML But Were Afraid To Ask

1,715

Published on

Short internal XML course (2003). Interesting to note that RSS doesn't feature - hadn't quite hoved into our view at that point. Also no mention of OxygenXML - was I really not using it then? Seem to …

Short internal XML course (2003). Interesting to note that RSS doesn't feature - hadn't quite hoved into our view at that point. Also no mention of OxygenXML - was I really not using it then? Seem to have been using it forever.

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

No Downloads
Views
Total Views
1,715
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Transcript

    • 1. “ Everything you always wanted to know about XML * * But were afraid to ask”
    • 2. &lt;everything&gt; <ul><li>XML basics </li></ul><ul><li>A bit of web history </li></ul><ul><li>XML in detail </li></ul><ul><li>Where is XML used? </li></ul><ul><li>Creating XML </li></ul><ul><li>Manipulating XML </li></ul><ul><li>Pros and cons </li></ul>
    • 3. XML basics <ul><li>&lt;?xml version=&amp;quot; 1.0 &amp;quot;?&gt; </li></ul><ul><li>&lt;manual id=&amp;quot; CRDA/ULCC/IMP/BPM/1.0 &amp;quot;&gt; </li></ul><ul><li>&lt;title&gt; Biscuit Procedures Manual &lt;/title&gt; </li></ul><ul><li>&lt;author&gt; Ruth Vyse &lt;/author&gt; </li></ul><ul><li>&lt;date&gt; 1998-04-01 &lt;/date&gt; </li></ul><ul><li>&lt;content&gt; </li></ul><ul><li>&lt;heading&gt; Purpose &lt;/heading&gt; </li></ul><ul><li>&lt;para&gt; This document describes the procedures for </li></ul><ul><li>&lt;list&gt; </li></ul><ul><li>&lt;item&gt; provision of an adequate quantity of biscuits &lt;/item&gt; </li></ul><ul><li>&lt;item&gt; provision of an adequate variety of biscuits &lt;/item&gt; </li></ul><ul><li>&lt;/list&gt; </li></ul><ul><li>&lt;/para&gt; </li></ul><ul><li>&lt;/content&gt; </li></ul><ul><li>&lt;/manual&gt; </li></ul><ul><li>XML declaration </li></ul><ul><li>Elements </li></ul><ul><li>Attributes </li></ul><ul><li>Well-formed </li></ul><ul><li>Valid? </li></ul>
    • 4. A bit of web history <ul><li>SGML </li></ul><ul><li>HTML </li></ul><ul><li>Cascading Style Sheets (CSS) </li></ul><ul><li>Javascript </li></ul>
    • 5. Standard Generalized Markup Language (SGML) <ul><li>ISO Standard 8879:1986 </li></ul><ul><li>Define structured document types </li></ul><ul><li>Markup languages for structured documents </li></ul><ul><li>Main components - </li></ul><ul><ul><li>Elements delimited by tags </li></ul></ul><ul><ul><li>Attributes </li></ul></ul><ul><ul><li>Character data </li></ul></ul><ul><ul><li>Entities </li></ul></ul>
    • 6. Hypertext Markup Language (HTML) <ul><li>An application of SGML </li></ul><ul><li>Hyperlinks / hypertext </li></ul><ul><li>Designed for structural markup of documents </li></ul><ul><li>Evolution: </li></ul><ul><ul><li>4 major versions </li></ul></ul><ul><ul><li>Non-standard extensions (Netscape, MS) </li></ul></ul><ul><ul><li>Superseded by XHTML </li></ul></ul>
    • 7. Cascading Style Sheets (CSS) <ul><li>body { font-family: serif ; </li></ul><ul><li>text-align: justify ; </li></ul><ul><li>margin: 0pt ; </li></ul><ul><li>background-color: white ; </li></ul><ul><li>color: black } </li></ul><ul><li>h1, h2, h3 { font-family: sans-serif ; </li></ul><ul><li>font-weight: bold ; </li></ul><ul><li>text-align: left ; } </li></ul><ul><li>.reverse { background-color: black ; </li></ul><ul><li>color: white } </li></ul><ul><li>Non SGML syntax </li></ul><ul><li>Properties cascade to descendants </li></ul><ul><li>Styles can be defined: </li></ul><ul><ul><li>In external files </li></ul></ul><ul><ul><li>In document header </li></ul></ul><ul><ul><li>Inline </li></ul></ul>
    • 8. Javascript <ul><li>Interface to browser functions </li></ul><ul><li>&amp;quot;Document object&amp;quot; </li></ul><ul><li>Event-driven interaction with </li></ul><ul><ul><li>Forms </li></ul></ul><ul><ul><li>Images </li></ul></ul><ul><ul><li>Formatting </li></ul></ul><ul><li>Security: limited IO </li></ul><ul><li>Object-oriented </li></ul><ul><li>ECMA 262 / ISO 16262 </li></ul><ul><li>&lt;html&gt; </li></ul><ul><li>&lt;head&gt; </li></ul><ul><li>&lt;script language=“ Javascript ”&gt; </li></ul><ul><li>function helloWorld() { </li></ul><ul><li>var message = “Hello World”; </li></ul><ul><li>document.form[0].elements[0].value </li></ul><ul><li>= message; </li></ul><ul><li>} </li></ul><ul><li>&lt;/script&gt; </li></ul><ul><li>&lt;/head&gt; </li></ul><ul><li>&lt;body&gt; </li></ul><ul><li>&lt;form&gt; </li></ul><ul><li>&lt;input type=“ text ”&gt; </li></ul><ul><li>&lt;input type=“ button ” </li></ul><ul><li>onClick=“ helloWorld ();”&gt; </li></ul><ul><li>&lt;/form&gt; </li></ul><ul><li>&lt;/body&gt; </li></ul><ul><li>&lt;/html&gt; </li></ul>
    • 9. <ul><li>&lt;mylink style =&amp;quot; color: blue; text-decoration: underline &amp;quot; onClick=&amp;quot; location=&apos;http://ndad.ulcc.ac.uk/&apos;; &amp;quot;&gt; NDAD &lt;/mylink&gt; </li></ul>
    • 10. XML in a little more detail <ul><li>&lt;?xml version=&amp;quot; 1.0 &amp;quot; </li></ul><ul><li>encoding=&amp;quot; ISO-8859-1 &amp;quot; ?&gt; </li></ul><ul><li>&lt;!DOCTYPE ead SYSTEM &amp;quot; ead.dtd &amp;quot;&gt; </li></ul><ul><li>&lt;ead audience=&amp;quot; internal &amp;quot;&gt; </li></ul><ul><li>&lt;eadheader langencoding=&amp;quot; ISO 639-3 &amp;quot;&gt; </li></ul><ul><li>&lt;titleproper&gt; Lord Chancellor&apos;s Department: </li></ul><ul><li>Judge Advocate General&apos;s Office Case Index System &lt;/titleproper&gt; </li></ul><ul><li>&lt;date&gt; 2002-08-06 10:52:20 &lt;/date&gt; </li></ul><ul><li>&lt;/eadheader&gt; </li></ul><ul><li>&lt;archdesc level=&amp;quot; series &amp;quot; &gt; </li></ul><ul><li>&lt;scopecontent id=&amp;quot; AIM-PURPOSE &amp;quot;&gt; </li></ul><ul><li>&lt;head&gt; Aim and purpose &lt;/head&gt; </li></ul><ul><li>&lt;p&gt; A court martial is a court convened to try armed forces personnel who have committed military or criminal offences. &lt;/p&gt; </li></ul><ul><li>&lt;/scopecontent&gt; </li></ul><ul><li>&lt;/archdesc&gt; </li></ul><ul><li>&lt;/ead&gt; </li></ul><ul><li>Character encoding </li></ul><ul><li>DTD </li></ul><ul><li>Namespaces </li></ul>
    • 11. Character encoding <ul><li>ASCII: ISO 646 </li></ul><ul><ul><li>7 bit </li></ul></ul><ul><li>ISO 8859 </li></ul><ul><ul><li>8 bit </li></ul></ul><ul><ul><li>Top half interchangeable </li></ul></ul><ul><li>Unicode: ISO 10646 </li></ul><ul><ul><li>Code for every symbol of every language </li></ul></ul><ul><ul><li>Variable 8 - 32 bit encoding (UTF-8) </li></ul></ul><ul><ul><li>ASCII transparent in 8 bit encoding </li></ul></ul>
    • 12. Document Type Definition (DTD) <ul><li>SGML compatible </li></ul><ul><li>Non XML syntax * </li></ul><ul><li>Defines document structure </li></ul><ul><ul><li>Elements </li></ul></ul><ul><ul><li>Attributes </li></ul></ul><ul><ul><li>Entities </li></ul></ul><ul><li>* pointy brackets notwithstanding </li></ul><ul><li>&lt;!ELEMENT table (title, datafile, field+) &gt; </li></ul><ul><li>&lt;!ELEMENT title ( #PCDATA ) &gt; </li></ul><ul><li>&lt;!ELEMENT datafile (bytes, numrecs, maxrecsize) &gt; </li></ul><ul><li>&lt;!ELEMENT field (name, description, ddtext?, note?, choices?) &gt; </li></ul><ul><li>&lt;!ATTLIST table reference CDATA #REQUIRED &gt; </li></ul><ul><li>&lt;!ATTLIST datafile type CDATA #REQUIRED </li></ul><ul><li>location CDATA #REQUIRED&gt; </li></ul><ul><li>&lt;!ATTLIST field type CDATA #REQUIRED&gt; </li></ul><ul><li>&lt;!ENTITY NDAD &amp;quot;http://ndad.ulcc.ac.uk/&amp;quot; &gt; </li></ul>
    • 13. Namespaces <ul><li>Mix and match XML applications </li></ul><ul><li>Avoid conflicting elements </li></ul><ul><li>Limited DTD compatibility </li></ul>&lt;?xml version=&amp;quot; 1.0 &amp;quot; encoding=&amp;quot; ISO-8859_1 &amp;quot; ?&gt; &lt;table reference = &amp;quot; CRDA/8/DS/1/1/1 &amp;quot;&gt;   &lt;title&gt; Court Details &lt;/title&gt;   &lt;datafile type=&amp;quot; CSV &amp;quot; location =&amp;quot;/data/ready/8/court.txt &amp;quot;&gt; &lt;bytes&gt; 20583 &lt;/bytes&gt;     &lt;numrecs&gt; 388 &lt;/numrecs&gt;     &lt;maxrecsize&gt; 65 &lt;/maxrecsize&gt;   &lt;/datafile&gt; &lt;description xmlns:html =&amp;quot; http://www.w3.org/1999/xhtml &amp;quot;&gt; &lt; html:p &gt; For further details see the &lt; html:a href=&amp;quot; /datasets/8/series.htm &amp;quot;&gt; Series Catalogue &lt; /html:a &gt; . &lt; /html:p &gt; &lt;/description&gt; &lt;/table&gt;
    • 14. Where is XML used? <ul><li>Web </li></ul><ul><li>Desktop applications </li></ul><ul><li>New markup applications </li></ul><ul><li>Standards for data exchange </li></ul><ul><li>Configuration files </li></ul>
    • 15. Web <ul><li>Server side </li></ul><ul><ul><li>on-the-fly transformation to HTML / XHTML using XSLT </li></ul></ul><ul><li>Client side </li></ul><ul><ul><li>rendered native using CSS </li></ul></ul><ul><ul><li>transformed to HTML / XHTML using XSLT </li></ul></ul><ul><li>Metadata </li></ul>
    • 16. Desktop applications <ul><li>OpenOffice/StarOffice </li></ul><ul><li>Mozilla/Netscape 6+ </li></ul><ul><li>MS Office 2000 </li></ul>
    • 17. Other applications <ul><li>Encoded Archival Description (EAD) </li></ul><ul><li>Text Encoding Initiative (TEI) </li></ul><ul><li>Scalable Vector Graphics (SVG) </li></ul><ul><li>XHTML </li></ul><ul><li>Custom applications </li></ul>
    • 18. Creating XML <ul><li>By hand </li></ul><ul><li>XML editors </li></ul><ul><li>Programming </li></ul><ul><li>Using XML ... </li></ul>
    • 19. XML editors <ul><li>Non-validating </li></ul><ul><ul><li>XML Notepad </li></ul></ul><ul><li>Validating </li></ul><ul><ul><li>Xmetal </li></ul></ul><ul><ul><li>XML Spy </li></ul></ul><ul><ul><li>XML Writer </li></ul></ul>
    • 20. Programming <ul><li>A simple Perl example: </li></ul><ul><li>#!/usr/bin/perl </li></ul><ul><li>use XML::LibXML; </li></ul><ul><li>$parser = new XML::LibXML; </li></ul><ul><li>$doc = $parser -&gt;parse_file(&amp;quot; myfile.xml &amp;quot;); </li></ul><ul><li>$root = $doc -&gt;getDocumentElement; </li></ul><ul><li>@fields = $root -&gt;getElementsByTagName(&amp;quot; field &amp;quot;); </li></ul><ul><li>foreach ( @fields ) { # do something # } </li></ul>
    • 21. Manipulating XML <ul><li>Document Object Model (DOM) </li></ul><ul><li>XPath </li></ul><ul><li>XML Stylesheets (XSL) </li></ul><ul><li>More XML applications </li></ul>
    • 22. Document Object Model (DOM) <ul><li>W3C recommendation </li></ul><ul><li>Application independent </li></ul><ul><li>Language/OS neutral </li></ul><ul><li>Hierarchical </li></ul><ul><ul><li>Parent </li></ul></ul><ul><ul><li>Children </li></ul></ul><ul><ul><li>Siblings </li></ul></ul><ul><li>Node types </li></ul><ul><ul><ul><li>Document </li></ul></ul></ul><ul><ul><ul><li>Element </li></ul></ul></ul><ul><ul><ul><li>Attribute </li></ul></ul></ul><ul><ul><ul><li>Text </li></ul></ul></ul><ul><ul><ul><li>Comment </li></ul></ul></ul><ul><ul><ul><li>Entity </li></ul></ul></ul><ul><ul><ul><li>+ 6 more </li></ul></ul></ul>
    • 23. XPath <ul><li>W3C recommendation </li></ul><ul><li>XML document as a tree of Nodes </li></ul><ul><li>Non XML syntax </li></ul><ul><li>Location paths </li></ul><ul><ul><li>Relative: ../../tr </li></ul></ul><ul><ul><li>Absolute: /html/body/h1 </li></ul></ul><ul><ul><li>Attributes: img@src </li></ul></ul><ul><ul><li>Axes: parent, child, sibling, etc </li></ul></ul><ul><li>Functions </li></ul><ul><ul><li>String: contains(), substring() </li></ul></ul><ul><ul><li>Array/node: last(), count(), position() </li></ul></ul>
    • 24. XML Stylesheets (XSL) <ul><li>W3C Recommendation </li></ul><ul><li>XML syntax </li></ul><ul><li>Transformations (XSLT) </li></ul><ul><li>Formatting objects (XSL-FO) </li></ul><ul><li>XSLT processor e.g. Sablotron (sabcmd) </li></ul>
    • 25. More XML applications <ul><li>XHTML (strict, transitional) </li></ul><ul><li>XML-Schema </li></ul><ul><li>RELAX-NG </li></ul><ul><li>XLink </li></ul><ul><li>XPointer </li></ul><ul><li>XML Query </li></ul>
    • 26. <ul><li>Open standard </li></ul><ul><li>Flexible </li></ul><ul><li>Transformable </li></ul><ul><li>Not going to be around forever </li></ul><ul><li>Simple </li></ul><ul><li>Complex </li></ul><ul><li>Machine-readable </li></ul><ul><li>Human-readable </li></ul>
    • 27. &lt;/everything&gt;

    ×