Introduction to XML - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction to XML

Description:

Title: Introduction to XML Author: Spokane County Last modified by: Spokane County Created Date: 3/25/2003 7:55:33 PM Document presentation format – PowerPoint PPT presentation

Number of Views:67
Avg rating:3.0/5.0
Slides: 17
Provided by: Spok67
Category:

less

Transcript and Presenter's Notes

Title: Introduction to XML


1
Introduction to XML
  • Allyson Falkner
  • Spokane County ISD
  • afalkner_at_spokanecounty.org

2
Overview
  • Why XML?
  • What is XML?
  • Example XML document
  • General rules of well-formed XML
  • Parts of an XML document
  • Applications for XML

3
Why XML?
  • SGML (Standard Generalized Markup Language)
  • an all encompassing markup language
  • big and complex
  • software to manage it is expensive.
  • HTML (HyperText Markup Language)
  • Simplistic
  • no separation of style
  • XML (eXtensible Markup Language)
  • Flexibility of SGML
  • Simplicity of HTML

4
What is XML?
  • A set of rules to store and organize any
    information
  • Open Standard developed by W3C (www.w3.org/TR/rec-
    xml)
  • Unicode is its standard character set
  • Separates content from style
  • Very Structured

5
Example XML document
  • lt?xml version1.0?gt
  • ltmemo priorityimportantgt
  • lttogtSaralt/togt
  • ltsubjectgtReminderlt/subjectgt
  • ltmessagegtDonapost forget, ltemphasizegtSWIGlt/emph
    asizegt tonight!
  • ltgraphic filerefsmiley.face.pict/gtlt/messagegt
  • ltfromgtAllysonlt/fromgt
  • lt/memogt

6
General rules of well-formed XML
  • must begin with the XML declaration
  • must have one unique root element
  • all start tags must match end-tags
  • XML tags are case sensitive
  • all elements must be closed
  • all elements must be properly nested
  • all attribute values must be quoted
  • XML entities must be used for special characters

7
Parts of an XML document
  • Document Prolog
  • Elements
  • Attributes
  • Entities
  • Others
  • Comments
  • CDATA
  • Namespaces
  • Processing Instruction

8
Document Prolog
  • XML declaration
  • Version
  • Encoding
  • standalone
  • Document type declaration (root element type)
  • Document type definition (DTD)
  • Internal subset
  • Entity declarations
  • All or part of DTD

9
Elements
  • Container element
  • ltname att1val1 att2val2gt
  • content
  • lt/namegt
  • Empty element
  • ltname att1val1 att2val2/gt

10
Element Name
  • Names can contain letters, numbers, and other
    characters
  • Names must not start with a number or punctuation
    character
  • Names must not start with the letters xml (or XML
    or Xml ..)
  • Names cannot contain spaces

11
Element Content
  • element content (elements only)
  • simple content (text only)
  • mixed content (both text and elements)
  • empty content

12
Attributes
  • namevalue
  • Attribute name must be distinct within the
    element tag
  • Cannot contain multiple values

13
Caution about Attributes
  • Only data about data should be stored as
    attributes because
  • attributes cannot contain multiple values (child
    elements can)
  • attributes are not easily expandable (for future
    changes)
  • attributes cannot describe structures (child
    elements can)
  • attributes are more difficult to manipulate by
    program code
  • attribute values are not easy to test against a
    DTD

14
Entities
  • General entities
  • name
  • Character entities
  • Predefined character entities (amp, apos, gt, lt,
    quote)
  • Numbered character entities (231 or xe7 )
  • Named character entities (must be predefined
    ISO-8879)
  • Mixed Content entities
  • Internal declared in doc prolog
  • External in another file
  • Unparsed entities
  • lt!ENTITIY smiley SYSTEM /images/smile.gif NDATA
    GIFgt
  • Parameter entities (used in DTDs)
  • name

15
Others
  • Comments
  • lt! text and markup ?
  • Cannot contain two dashes
  • Cannot go before xml declaration
  • CDATA (character data)
  • lt! CDATA textgt
  • Processing Instructions
  • lt?name data?gt
  • Namespaces
  • No external DTD so difficult to use
  • Cant validate

16
Applications for XML
  • Communicating among applications over the web
  • Storing databases
  • Transforming data
  • Repurposing data (display and use server
    different ways)
  • Defining special data (math, music,graphics )
  • Sharing data (news paper articles, )
Write a Comment
User Comments (0)
About PowerShow.com