The extensible markup language: An introduction to XML - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

The extensible markup language: An introduction to XML

Description:

XML stands for EXtensible Markup Language. XML is a markup ... Museum of Modern Art, NewYork ... – PowerPoint PPT presentation

Number of Views:102
Avg rating:3.0/5.0
Slides: 15
Provided by: vsi4
Category:

less

Transcript and Presenter's Notes

Title: The extensible markup language: An introduction to XML


1
  • The extensible markup languageAn introduction
    to XML

What is a XML document ? How do we check its
validity ? How do we display its content ?
2
What Is XML ?
  • XML stands for EXtensible Markup Language
  • XML is a markup language much like HTML
  • XML was designed to describe data
  • XML tags are not predefined in XML you must
    define your own tags
  • XML uses a DTD (Document Type Definition) to
    describe the data
  • XML with a DTD is designed to be self describing
  • XML uses a CSS (Cascading Style Sheets) to
    display information

3
An Example XML Document
lt?xml version1.0?gt ltartistgt
ltnamegtltfirstgtVincentlt/firstgtltlastgtvan
Goghlt/lastgtlt/namegt ltborngtltdategt1853lt/dategtltplace
gtHollandlt/placegtlt/borngt ltdiedgtltdategt1890lt/dategtlt
placegtFrancelt/placegtlt/diedgt ltartworkgt
ltartifactgt lttitlegtThe Starry Nightlt/titlegt
ltdategt1889lt/dategt ltmaterialgtOil on
Canvaslt/materialgt ltdimgt ltheight
metrics_type"in"gt29lt/heightgt ltwidth
metrics_type"in"gt36 1/4lt/widthgt lt/dimgt
ltlocationgtMuseum of Modern Art,
NewYorklt/locationgt ltimage
file"starry-night.jpg"gtlt/imagegt
lt/artifactgt lt/artistgt
xml-declaration
element content
end-tag
start-tag
root element
4
An Example XML Document
lt?xml version1.0?gt ltartistgt
ltnamegtltfirstgtVincentlt/firstgtltlastgtvan
Goghlt/lastgtlt/namegt ltborngtltdategt1853lt/dategtltplace
gtHollandlt/placegtlt/borngt ltdiedgtltdategt1890lt/dategtlt
placegtFrancelt/placegtlt/diedgt ltartworkgt
ltartifactgt lttitlegtThe Starry Nightlt/titlegt
ltdategt1889lt/dategt ltmaterialgtOil on
Canvaslt/materialgt ltdimgt ltheight
metrics_type"in"gt29lt/heightgt ltwidth
metrics_type"in"gt36 1/4lt/widthgt lt/dimgt
ltlocationgtMuseum of Modern Art,
NewYorklt/locationgt ltimage
file"starry-night.jpg"gtlt/imagegt
lt/artifactgt lt/artistgt
attribute name
attribute value
5
Well Formed vs Valid XML Documents
  • XML (document) with correct syntax is Well Formed
    XML
  • All XML elements must have a closing tag
  • XML tags are case sensitive
  • All XML elements must be properly nested
  • All XML documents must have a root tag
  • Attribute values must always be quoted
  • XML (document) validated against a DTD is Valid
    XML
  • A DTD defines the legal elements of an XML
    document

lt?xml version1.0?gt lt!DOCTYPE artist SYSTEM
artist.dtd"gt ltartistgt ltnamegtltfirstgtVincentlt
/firstgtltlastgtvan Goghlt/lastgtlt/namegt
ltborngtltdategt1853lt/dategtltplacegtHollandlt/placegtlt/bor
ngt
6
An Example XML DTD
lt?xml version1.0?gt lt!ELEMENT artist (name ,
born , died? , artwork?)gt lt!ELEMENT name (first ,
last)gt lt!ELEMENT first (PCDATA)gt lt!ELEMENT last
(PCDATA)gt lt!ELEMENT born (date ,
place?)gt lt!ELEMENT died (date ,
place?)gt lt!ELEMENT date (PCDATA)gt lt!ELEMENT
place (PCDATA)gt lt!ELEMENT artwork
(artifact)gt lt!ELEMENT artifact (title , date? ,
material , dim , location , image)gt lt!ELEMENT
title (PCDATA)gt lt!ELEMENT material (PCDATA)gt
lt!ELEMENT dim (height , width)gt lt!ELEMENT height
(PCDATA)gt lt!ATTLIST height metrics_type CDATA
IMPLIED gt lt!ELEMENT width (PCDATA)gt lt!ATTLIST
width metrics_type CDATA IMPLIED gt lt!ELEMENT
location (PCDATA)gt lt!ELEMENT image
EMPTY)gt lt!ATTLIST image file CDATA
IMPLIED gt
GROUP element with children (sequences)
Declaring zero or one occurrences of the same
element (?)
Declaring zero or more occurrences of the same
element ()
Elements with only character data
7
XML DTD Building Blocks
  • Elements
  • Elements are the main building blocks of both XML
    and HTML documents
  • Tags are used to markup elements (e.g. ltnamegt
    lt/namegt)
  • Elements are nested and may define a specific
    sequence
  • Attributes
  • Attributes provide extra information about
    elements (other than their content and type)
  • Attributes are always placed inside the starting
    tag of an element Attributes always come in
    name/value pairs
  • (e.g. ltwidth metrics_type"in"gt36 1/4lt/widthgt)
  • May be applied to one specific instance of a
    given element
  • Entities
  • Entities are variables used to define common text

8
XML DTD Elements
9
XML DTD Attributes and Entities
10
Viewing XML Documents with IE 5.0
11
Displaying XML with CSS
12
What is CSS ?
  • CSS stands for Cascading Style Sheets
  • Styles define how to display HTML/XML elements
  • Styles are normally stored in Style Sheets
  • Styles were added to HTML 4.0 to solve a problem
  • External Style Sheets can save you a lot of work
  • External Style Sheets are stored in CSS files
  • Multiple style definitions will cascade into on
  • cascading order

13
CSS Syntax
  • Use of External Style Sheets

lt?xml version1.0?gt lt!DOCTYPE artist SYSTEM
artist.dtdgt lt?xml-stylesheet type"text/css"
href"artist.css"?gt ltartistgt . . .
  • Basic syntax

title font-family Palatino font-size
16pt font-weight bold text-align center
color 6699CC
  • Grouping

artifact, artist, artwork, name, title
font-family Arial font-size 16pt display
block
14
CSS Display Properties
  • Background properties (color, image, position)
  • Text properties (color, alignment, direction,
    letter-spacing)
  • Font properties (family, size, style, weight)
  • Border properties (color, style, width)
  • Margin properties
  • Padding properties
  • Classification properties (visibility, inline,
    block)
  • Pseudo-elements (before, after)
Write a Comment
User Comments (0)
About PowerShow.com