Download presentation
Presentation is loading. Please wait.
1
<XML> <Introduction>Yes</> </XML>
Dongwon Lee, Ph.D. The Pennsylvania State University IST 516 / Fall 2011
2
Overview Motivation of XML HTML vs. XML What is XML? XML Usages
Exercise
3
XML What does XML stand for (SAT question)? X-rated Modular 3 Language
eXtensible Standard ML Programming Language eXtensible UML (Unified Modeling Language) for the Web eXtensible Meta Language for the Web eXtensible Markup Language originating from SGML None of the above
4
What Human Sees About Penn State Prospective Students Academic Programs Outreach Programs Global Penn State Campuses and Colleges Visitors Guide Alumni, Friends, and Giving …
5
What Machine Sees WWW2002 The eleventh international world wide web conference Sheraton waikiki hotel Honolulu, hawaii, USA 7-11 may location 5 days learn interact Registered participants coming
6
Solution #1: Give Data Meaningful Tags
<School> <Name>WWW2002</Name> <TOC>The eleventh international world wide web conference</TOC> <Description>Sheraton waikiki hotel Honolulu, hawaii, USA 7-11 may location 5 days learn interact</Description> </School>
7
What Machine Sees from Solution #1
<lear> <days>WWW2002</days> <wide>The eleventh international world wide web conference</wide> <2002>Sheraton waikiki hotel Honolulu, hawaii, USA 7-11 may location 5 days learn interact</2002> </lear> Better than before. Still NO clear and precise meanings of tags known to machines
8
XML XML was designed to describe data, not format
XML is a framework for defining markup languages XML was designed to describe data, not format Format is separately described by stylesheets XML separates syntax from semantics to provide a common framework for structuring information NO fixed collection of markup tags: One must define own tags, tailored for specific apps XML uses a schema language (eg, DTD, XML-Schema) to formally describe the data.
9
XML XML is NOT a replacement for HTML:
HTML should ideally be just another XML language in fact, XHTML is just that XHTML is a (very popular) XML language for hypertext markup HTML is about displaying information, but XML is about describing information.
10
HTML vs. XML XML HTML <center> <h1>SIGMOD</h1>
<p><b> <u>ACM</u> <a href=“sigmod02.org”>SIGMOD Conference</a>, Madison, WI, 2002 </b></p> </center> <event eID=“sigmod02”> <acronym>SIGMOD</acronym> <society>ACM</society> <url> <loc> <city>Madison</city> <state>WI</state> </loc> <year>2002</year> </event>
11
HTML vs. XML Need a stylesheet to define browser presentation semantics HTML XML CSS/XSL Browser Browser
12
HTML vs. XML Need a stylesheet to define browser presentation semantics Data/Format Data Format Browser Browser
13
XML 1.0 and 1.1 Two current versions of XML XML 1.0 XML 1.1
Initially released in 1998 Latest release in 2008 (5th edition) XML 1.1 Initially released in 2004 Latest release in 2006 (2nd edition) Widely implemented & supported as of 2011
14
SGML XML
15
A Conceptual View of XML
An XML document is an ordered, labeled tree Character data leaf nodes contain the actual data (text strings) Elements nodes are each labeled with a name (often called the element type), and a set of attributes, each consisting of a name and a value, and can have child nodes
16
Start, End, Empty Element Tags
Element Tags can be 3 types: Start: < foo > Eg, “<html> …” End: </ foo > Eg, “… </html>” Empty: < foo /> Eg, <img src=“foo.jpg” />
17
A Concrete View of XML An XML document is a text with markup tags and other meta-information. Markup tags denote elements: ..<foo attr="val" ...>bar</foo>... | | | | | | | a matching element end tag | | the contents “bar” of the element | an attribute with name attr and value val, enclosed by ' or " an element start tag with name foo
18
Example of XML Document
<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> XML declaration: the FIRST line of XML documents XML declaration consists of: The version number <?xml version="1.0"?> The encoding declaration <?xml version="1.0" encoding="UTF-8"?>
19
Example of XML Document
<?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> Root element is <note> In XML all elements must have a closing tag: <p>foo<p>bar <p>foo</p><p>bar</p> XML tags are case sensitive: <Message>This is incorrect</message> Must be properly nested within each other: <b><i>This is incorrect</b></i>
20
Well-Formed XML Well-Formed: a document conforms to XML syntax rules such as: Begin with XML declaration One unique root Case-sensitive Matching Start / End tags Properly nested Well-formed documents can still contain semantic errors or inconsistencies Need VALID documents according to schema
21
From http://www.w3schools.com/
xml/xml_tree.asp
22
Element vs. Attribute The same information can be captured by either Element or Attribute in XML <event eID=“sigmod02”> <acronym>SIGMOD</acronym> <society>ACM</society> <url> <loc> <city>Madison</city> <state>WI</state> </loc> <year>2002</year> </event> <event eID=“sigmod02” acronym=“SIGMOD” society=“ACM url=“ city=“Madison” state=“WI” year=“2002”/>
23
When to use Element vs. Attribute ?
Need order Nested sub-structure <a><b><c/></b></a> Need more concise notations Want to provide default value Need to refer to other data piece Eg, ID/IDREF in DTD Element Attribute
24
Applications of XML XML is a meta-language to create another languages; the main application of XML is making new languages XHTML: W3C's XMLization of HTML 4.0. <?xml version="1.0" encoding="UTF-8"?> <html xmlns= xml:lang="en"> <head><title>Hello world!</title></head> <body><p>foobar</p></body> </html>
25
MathML: Mathematical Markup Langiage
From:
26
CML: Chemical Markup Language
<molecule id="METHANOL"> <atomArray> <stringArray builtin="elementType">C O H H H H</stringArray> <floatArray builtin="x3" units="pm"> </floatArray> </atomArray> </molecule>
27
RSS: Really Simple Syndication
The XML Source view of IST’s RSS
28
RSS: Really Simple Syndication
29
XBEL: XML Bookmark Exchange Language
XML language to express bookmarks (ie, favorites) in common format Several web browsers store their bookmarks in XBEL format Eg, Galeon, Konqueror, Arora Apps use XBEL format Eg, XBELicious
30
Weather Service in XML
31
XML Usages in S/W Open Office XML OpenDocument Apple’s iWork
32
Why is XML Important? Technically, … little initially; Just old simple tree model… Non-technically, … Hot ($$$) The standard for representation of Web information The real force of XML is generic languages and tools! By building on XML, you get a massive (standard) infrastructure for free
33
XML Offers Common extensions to the core XML specification: a namespace mechanism, document inclusion, etc. Schemas: grammars to define classes of documents Linking between documents: a generalization of HTML anchors and links Transformation: conversion from one document class to another Querying: extraction of information, generalizing relational databases More…
35
Exercise: Make Your First XML
TO-DO: Add an Empty Element Add an Attribute to <body> Add a child element to <from> Change <to> as an attribute of <note> element
36
References World-Wide Web Consortium: www.w3c.org/xml/
XML Cover Page: XML Articles: Latest XML News: XML Tutorial: XML WIKI: en.wikibooks.org/wiki/XML
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.