Title: XML Extensible Markup Language
1 XML (Extensible Markup Language
- XML is a markup language.
- XML stands for eXtensible Markup Language.
- The XML standard was created by W3C to provide
an easy to use and standardized way to store
self-describing data (self-describing data is
data that describes both its content and its
structure).
2 Communication Between Application
XML is nothing by itself. XML is more of a
"common ground" standard. The main benefit of XML
is that you can use it to take data from a
program like MSSQL (Microsoft SQL), convert it
into XML, then share that XML with a slough of
other programs and platforms What makes XML truly
powerful is the international acceptance it has
received. Many individuals and corporations have
put forth their hard work to make XML interfaces
for databases, programming, office application,
mobile phones and more.
3Applications of XML
- Cell Phones - XML data is sent to some
cell phones. The data is then formatted by the
specification of the cell phone software designer
to display text or images, and even to play
sounds! - File Converters - Many applications have
been written to convert existing documents into
the XML standard. An example is a PDF to XML
converter. - VoiceXML - Converts XML documents into an
audio format so that you can listen to an XML
document.
4Free XML Viewer
- Internet Explorer 6.0 supports viewing XML files.
- You can download IE 6.0 from Microsoft's Website.
Internet Explorer 6.0 has special color coding
the make XML documents easier to read. - Firefox XML Viewer Firefox has some of the same
features as Internet Explorer. You can download
Mozilla's Firefox from Mozilla.com. - Free XML Editors
- There are many free XML editors available for
download on the internet. Here are a few we have
found useful - XML Cooktop
- XML Mind Standard Edition
- Pete's XML Editor
5XML Syntax
- XML Code
- lt?xml version"1.0" encoding"ISO-8859-15"?gt
- ltclass_listgt
- ltstudentgt
- ltnamegtRobertlt/namegt
- ltgradegtAlt/gradegt
- lt/studentgt
- ltstudentgt
- ltnamegtLenardlt/namegt
- ltgradegtA-lt/gradegt
- lt/studentgt
- lt/class_listgt
6XML code.
- lt?xml version"1.0" encoding"ISO-8859-15"?gt
- This line with special symbols and attributes is
what is referred to as the XML declaration. It
simply states what version of XML you are using
and the type of encoding you are using - XML Tag
- The XML tag is very similar to that of the HTML
tag. Each element is marked with an opening tag
and a closing tag. - ltnamegtRobertlt/namegt
- ltgradegtAlt/gradegt
7XML Elements
- They contain the opening and closing tags, child
elements, and data. - ltstudentgt
- ltnamegtRobertlt/namegt
- ltgradegtAlt/gradegt
- lt/studentgt
- XML Attribute
- An attribute appears within the opening tag of
an element. - ltstudent active"true"gt
- ltnamegtRobertlt/namegt
- ltgradegtAlt/gradegt
- lt/studentgt
8XML Attribute Quotation Usage
- The types of quotes that you use around your
attribute values is entirely up to you. Both the
single quote (') and the double quote (") are
perfectly fine to use in your XML documents. - ltstudent nicknameRob "The Dog''gt
- ltnamegtRobertlt/namegt
- ltgradegtAlt/gradegt
- lt/studentgt
- ltstudent group"Pete's Pandas"gt
- ltnamegtRobertlt/namegt
- ltgradegtAlt/gradegt
- lt/studentgt
9XML Comment Syntax
- lt?xml version"1.0" encoding"ISO-8859-15"?gt
- lt!-- Students grades are updated bi-monthly --gt
- ltclass_listgt
- ltstudentgt
- ltnamegtRobertlt/namegt
- ltgradegtAlt/gradegt
- lt/studentgt
- ltstudentgt
- ltnamegtLenardlt/namegt
- ltgradegtA-lt/gradegt
- lt/studentgt
- lt/class_listgt
10- XML Commenting out XML
- To temporarily remove some XML code from your XML
document. - lt?xml version"1.0" encoding"ISO-8859-15"?gt
- ltclass_listgt
- ltstudentgt
- ltnamegtRobertlt/namegt
- ltgradegtAlt/gradegt
- lt/studentgt
- lt!--
- ltstudentgt
- ltnamegtLenardlt/namegt
- ltgradegtA-lt/gradegt
- lt/studentgt
- --gt
- lt/class_listgt
11XML Prolog
- The prolog is an optional component of the XML
document. If included, the prolog must be appear
before the root element. A prolog consists of two
parts the XML declaration and the Document Type
Declaration (DTD). Depending on your needs, you
can choose to include both, either, or neither of
these items in your XML document. - lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" - "http//www.w3.org/TR/xhtml1/DTD/xhtml1-transitio
nal.dtd"gt
12- !DOCTYPE - Tell the XML processor that
this piece of code defines the Document Type
Definition - html - Specifies the root element of the
XML document. Here our example is an HTML file,
which has lthtmlgt as the root element. - PUBLIC - Specifies that this a publicly
available DTD. - "-//W3C//D..." - The definition of the
public document. Describing this is beyond the
scope of this tutorial. - "http//www.w3.org/..." - The physical
location of the DTD. Notice how this DTD resides
on w3's servers.
13XML Nesting
- When an element appears within another element,
it is said that the inner element is "nested".
The term nested can be related directly to the
word "nest". If an element is nested within
another element, then it is surrounded,
protected, or encapsulated by the outer element - Example A
- ltphonebookgt
- ltnumbergt
- ltnamegt
- lt/numbergt
- lt/namegt
- lt/phonebookgt
14Example B
ltphonebookgt ltnumbergt ltnamegt
lt/namegt lt/numbergt lt/phonebookgt All elements
are closed in the order that they were opened.
Those elements which were opened first are closed
last. Example B is what example A must look like
to be a well-formed XML document.
15- XML was designed to be a very robust markup
language that could be used in many different
applications. However, with XML being able to
communicate between so many different platforms,
there is one problem that tends to occur. - lt?xml version"1.0" encoding"ISO-8859-15"?gt
- lthtmlgt
- ltbodygt
- ltpgtWelcome to my Health Resourcelt/pgt
- lt/bodygt
- ltbodygt
- ltheightgt6ftlt/heightgt
- ltweightgt155 lbslt/weightgt
- lt/bodygt
- Two very different elements that want to use the
same name body. The solution to this problem is
to create XML Namespaces,
XML Namespaces
16- XML Documents Valid Versus Well-Formed
- In XML, there are three ways to measure a
document's validity valid, well-formed, and
broken. - One Root Element - The XML document may
only have one root element. See our Root Element
Lesson for more information. - Proper Nesting - XML elements must be
closed in the order they are opened. See our
Nesting Lesson for more information. - Well-Formed Entities - Any entities that
are referenced in the document must also be
well-formed. See our Entity Lesson for more
information.
17Broken XML Code
- ltemailgt
- lttogtMr. Garcia
- ltbodygtHello there! How are we today?lt/togt
- lt/bodygt
- lt/emailgt
- Well-Formed XML Code
- ltemailgt
- lttogtMr. Garcialt/togt
- ltbodygtHello there! How are we today?lt/bodygt
- lt/emailgt
- The error in the first example wasThe document
suffers from improper nesting. The body element
was opened inside the to element, yet body was
not closed before the to element was closed!
18XML Tree The great benefit about XML is that the
document itself describes the structure of data.
inventory is the root element.
19XML - The Tree Structure
20Structure of an XML Document
21Tree Structure
ltrootgt ltchildgt ltsubchildgt.....lt/subchildgt
lt/childgt lt/rootgt
22(No Transcript)
23(No Transcript)
24Entity References
If you place a character like "lt" inside an XML
element, it will generate an error because the
parser interprets it as the start of a new
element. ltmessagegtif salary lt 1000
thenlt/messagegt ltmessagegtif salary lt 1000
thenlt/messagegt There are 5 predefined entity
references in XML lt lt less than gt gt
greater than amp ampersand apos '
apostrophe quot " quotation mark
25XML(Table)
26XPath - Finding Information
XPath is the solution to finding information in
an XML document. XPath uses expressions to find
elements, attributes, and other information in
your XML. If you have an XML document that
contained a bunch of your favorite books, each
with author children elements, you can use a one
line XPath expression to find all the authors of
your favorite books! The most common place people
might see XPath expressions are in XSLT
(Extensible Stylesheet Language Transformation).
27Structure of an XML Document
28Structure of an XML Document
29Structure of an XML Document
30Structure of an XML Document
31Structure of an XML Document
32Structure of an XML Document
33Structure of an XML Document
34- XML is Used to Create New Internet Languages
- A lot of new Internet languages are created with
XML. - Here are some examples
- XHTML the latest version of HTML
- WSDL for describing available web services
- WAP and WML as markup languages for
handheld devices - RSS languages for news feeds
- RDF and OWL for describing resources and
ontology - SMIL for describing multimedia for the web
35SMIL 2.0 XML for Web Multimedia
- SMIL stands for Synchronized Multimedia
Integration Language - SMIL is pronounced "smile"
- SMIL is a language for describing audiovisual
presentations - SMIL is easy to learn and understand
- SMIL is an HTML-like language
- SMIL is written in XML
- SMIL presentations can be written using a
text-editor - SMIL is a W3C standard
36- Although plug-ins and media players have the
ability to show many different types of media
with varying support for interaction, only SMIL
offers the ability to define the presentation in
the form of text as a script. This feature could
be called media composition. - Also, SMIL offers accessibility options and
powerful features not present in other media
players.
What Can SMIL Do?
37Implementing SMIL
- Common SMIL implementations
- Internet or Intranet presentations.
- Slide show presentations.
- Presentations which link to other SMIL
files. - Presentations which have Control buttons
(stop, start, next, ...) - Defining sequences and duration of
multimedia elements. - Defining position and visibility of
multimedia elements. - Displaying multiple media types such as
audio, video, text - Displaying multiple files at the same time.
- Displaying files from multiple web servers.
- Currently, SMIL's most widespread usage is with
MMS. MMS (Multimedia Messaging System) is a
mobile device technology
38- Guidelines and Rules
- SMIL documents look a lot like HTML. SMIL files
need to be written according to the following
rules - SMIL documents must follow the XML rules of
well-formedness. - SMIL tags are case sensitive.
- All SMIL tags are written with lowercase
letters. - SMIL documents must start with a ltsmilgt tag
and end with a lt/smilgt closing tag. - SMIL documents must contain a ltbodygt tag
for storing the contents of the presentation. - SMIL documents can have a ltheadgt element
(like HTML) for storing metadata information
about the document itself, as well as
presentation layout information. -
39- ltsmilgt
- ltheadgt
- ltlayoutgt
- ...
- lt/layoutgt
- lt/headgt
- ltbodygt
- ...
- lt/bodygt
- lt/smilgt
40Image to our presentation
- ltsmilgt
- ltheadgt
- ltlayoutgt
- ltroot-layout width"300" height"300"
- background-color"white"/gt
- ltregion id"cows" top"0" left"0"
- width"300" height"197"/gt
- lt/layoutgt
- lt/headgt
- ltbodygt
- ltimg src"cows.jpg" region"cows"/gt
- lt/bodygt
- lt/smilgt
41- Copy and paste this URL, "http//html.tucows.com/d
esigner/basictut/example1.smil" into your SMIL
parser, i.e., RealPlayer, QuickTime, for an
example of the SMIL presentation created
42 Multiple Regions
We placed the new region, "text", 200 pixels
from the top and 50 pixels from the left so that
it's centered in our presentation.
43- Below is a table with the possible values we can
give to the fit attribute.
44- We want to make the tucows.gif image fit
perfectly within the region, so we would add
fit"fill" to the text region. Below is an
example.
45 Time Control
- You can also control how long you want a certain
piece of media to be display for by using the
"dur" attribute. This attribute takes a numerical
value in seconds with the letter "s" after the
number. For example, lets say we want the cows to
be displayed for 10 seconds and the rest of the
images for only 5. We would add "dur"10s"" to
the cow's img tag and "dur"5s"" to the rest of
the img tags. Below is what our code would look
like.
46- This should display the TUCOWS text image,
then the HTML text image during a span of 10
seconds.
47SMIL for phones
- MMS uses SMIL to define the layout of multimedia
content. - SMIL was adopted because it was a well-defined,
standard language to describe the layout and
timing of the content inside MMS messages.