XML An Introduction - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

XML An Introduction

Description:

Allows for multiple dynamic client applications. ... Entities begin with an ampersand, end in semi-colon. !ENTITY myent 'My Custom Entity' ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 16
Provided by: jamesmc81
Category:

less

Transcript and Presenter's Notes

Title: XML An Introduction


1
XML An Introduction
  • Structured Data Mark-up
  • James McCartney
  • CSCE 590, Cluster and Grid Computing

2
Why XML?
  • Allows creation of standardized markup.
  • Separates presentation logic from data.
  • Allows for multiple dynamic client applications.
  • Mandates machine readable, rational tags for
    describing data.
  • Support for wide ranging industry needs.

3
XML Requirements
  • Identify all types of information making up the
    content of your document.
  • Define the structure of each distinct type of
    information you are including in your document.

4
Tags, elements, and attributes.
  • ltaddressgt
  • ltnamegt
  • lttitlegtMrs.lt/titlegt
  • ltfirst-namegt
  • Mary
  • lt/first-namegt
  • ltlast-namegt
  • McGoon
  • lt/last-namegt
  • lt/namegt
  • ltstreetgt
  • 1401 Main Street
  • lt/streetgt
  • ltcity state"NC"gtAnytownlt/citygt
  • ltpostal-codegt
  • 34829
  • lt/postal-codegt
  • lt/addressgt
  • A tag is a value between the less than (lt) and
    greater than (gt) angle brackets.
  • An element includes the starting and ending tag,
    and everything between the two. This includes
    other (child) elements.
  • An attribute is a name value pair that is located
    in the opening tag of an element

5
Document States
  • Valid Documents abide by the XML syntax for
    document markup and follow the rules defined by
    their DTD and Schema definition.
  • Invalid Documents have syntax errors that dont
    conform to XML rules.
  • Well-formed Documents follow XML syntax rules,
    but dont have a DTD or Schema definition.

6
XML Structure
  • General Structure of an XML Document

7
XML Rules
  • An XML document must contain a single root
    element.
  • Elements cant overlap (jump levels).
  • End tags are required (at least lttag /gt).
  • Element names are case sensitive.
  • Attributes must have a value and the values must
    be quoted.

8
Parts and Pieces
  • Declaration a parser flag.
  • lt?xml version1.0 encodingISO-8859-1
    standaloneno?gt
  • Comments between lt!-- and --gt
  • Processing Instructions
  • lt?cocoon-process typesql?gt
  • Entities begin with an ampersand, end in
    semi-colon.
  • lt!ENTITY myent My Custom Entity!gt
  • lt gt amp quot apos

9
Namespaces
  • Namespaces allows developers to include multiple
    elements of the same name in the same document.

ltmath_test xmlnsmtesthttp//www.uark.edu/mathte
st/ xmlnsmmlhttp//www.w3.org/TR/REC-MathMLgt
ltmtestquestion id1gt ltmmlMIgtalt/mmlMIgt ltmm
lMOgt-lt/mmlMOgt ltmmlMIgtblt/mmlMIgt ltmmlMOgtlt/mm
lMOgt lt/math_testgt
10
Document Type Definition
  • DTD are used to describe the document element,
    order, and structure.
  • lt!-- address.dtd --gt
  • lt!ELEMENT address (name, street, city, state,
    postal-code)gt lt!ELEMENT name (title? first-name,
    last-name)gt
  • lt!ELEMENT title (PCDATA)gt
  • lt!ELEMENT first-name (PCDATA)gt
  • lt!ELEMENT last-name (PCDATA)gt
  • lt!ELEMENT street (PCDATA)gt
  • lt!ELEMENT city (PCDATA)gt
  • lt!ELEMENT state (PCDATA)gt
  • lt!ELEMENT postal-code (PCDATA)gt
  • ? Optional one or more zero or more choice

11
XML Schemas
  • XML Schemas use XML syntax, support datatypes
    (even user-defined), and have more expressions.
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltxsdschema xmlnsxsd"http//www.w3.org/2001/XML
    Schema"gt ltxsdelement name"address"gt
  • ltxsdcomplexTypegt ltxsdsequencegt
  • ltxsdelement ref"name"/gt
  • ltxsdelement ref"street"/gt
  • ltxsdelement name"postal-codegt
  • ltxsdsimpleTypegt ltxsdrestriction
    base"xsdstring"gt ltxsdpattern
    value"0-95(-0-94)?"/gt lt/xsdrestrictiongt
  • lt/xsdsimpleTypegt
  • lt/xsdelementgt
  • lt/xsdschemagt

12
DOM and SAX
  • Document Object Model digest the entire
    document and return a tree (of program objects)
    to be accessed by the program.
  • Simple API for XML event based model for
    parsing that allows program to catch document
    events as they are needed.

13
Standards
  • The Security Assertion Markup Language (SAML) is
    "an XML-based framework for exchanging security
    information.
  • Simple Object Access Protocol (SOAP) define an
    XML format for Remote Procedure Call.
  • XML-RPC is another less complex method for doing
    RPC.
  • The Web Services Description Language (WSDL)
    makes it possible to find a web service and
    interact with it without prior knowledge about
    its design.
  • Universal Description, Discovery, and Integration
    (UDDI) protocol defines how to query and publish
    web services with a registry.
  • SVG, XSL-FO, MATHML, XForms, OpenOffice.org,
    Extensible Messaging and Presence Protocol
    (XMPP), etc.

14
References
  • http//www.xml.com OReilly Network
  • http//www.xml.org - OASIS
  • http//www-106.ibm.com/developerworks/edu/x-dw-xml
    intro-i.html IBM tutorial on XML, Doug Tidwell
  • XML, The Complete Reference. Williamson, 2001
    McGraw-Hill

15
Questions?
  • XML Questions?
Write a Comment
User Comments (0)
About PowerShow.com