XML Training Course - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

XML Training Course

Description:

img src= 'ham.gif' br XML requires all elements be complete img src='ham.gif' /img ... img src='ham.gif' / br / Attributes. A property of an element ... – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 21
Provided by: randyb2
Category:
Tags: xml | course | imgsrc | training

less

Transcript and Presenter's Notes

Title: XML Training Course


1
XML Training Course
  • Module 2 XML Syntax

2
What to expect this Session
  • What is an XML Document?
  • The Prolog of an XML Document
  • Elements
  • Attributes
  • Comments
  • Processing Instructions

3
Sample Document
  • Joe Schmoe
  • Jane Doe
  • Cal Smith
  • 01/31/2003
  • XML Rocks
  • I just returned from Montgomery where I
    attended a training session on XML provided by
    the Information Services Association. At the
    workshop I learned the basics about XML, like how
    to create an XML document and how to present it.
    I am excited to report that I have already
    brainstormed several ways we can implement XML at
    our institution that will provide better service
    to students. I look forward to meeting with you
    and sharing the knowledge and my ideas.

4
XML Document
  • SGML definition a collection of information
    that is processed as a unit
  • For this discussion, we will define it as the
    contents of a single file.
  • That file contains tags, attributes for those
    tags, and content that goes in between the tags.

5
The Prolog (Opening Section)
  • The first item that should appear in any XML
    document is the XML Declaration.
  • HTML Declaration
  • XML Declaration

6
XML is Case-Sensitive
  • In HTML, authors have to freedom to choose how
    they write their elements.
  • In XML, case does matter.
  • ¹ ¹

7
The Prolog (Opening Section)
  • Next come the DOCTYPE construct
  • This contains the instructions about how to
    validate the document

8
The DOCTYPE Declaration
  • A Document Type Definition (DTD) is a set of
    rules that validate an XML document.
  • Those rules can either be written internally to
    the document or they may be referenced using a
    URL (or a combination of the two).

9
The DOCTYPE Declaration
  • Made up of 3 parts
  • Semantic Name (not filename) MEMO
  • URL of the file http//www.foo.com/memo.dtd

10
The Document/Root Element
  • Every XML document must have a single element
    that contains all other elements.
  • This is known as the Root Element or the Document
    Element.
  • In our example is the root element.

11
Document Content
  • What comes next is what we traditionally think of
    as the the document that is, the actual
    content.
  • Expressed using one of 4 methods
  • Elements
  • Attributes
  • Comments
  • Processing Instructions

12
Elements
  • Elements are the primary logical components of a
    document.
  • They are bound by start tags and end tags.
  • Hostess Twinkies

13
Elements
  • Sometimes elements do not have any content.
    These are known as empty elements.

  • XML requires all elements be complete


  • or


14
Attributes
  • A property of an element
  • Expressed as information within the elements
    start tag
  • Hostess Twinkies

15
Attributes
  • Composed structurally of name value pairs
  • All attributes values must be enclosed in
    quotation marks.
  • Guideline Use attributes to store information
    about the element.

16
Comments
  • A comment written in XML is syntactically
    equivalent to those found in HTML.
  • Comments may appear anywhere in a document,
    provided they are outside other markup and not
    immediately prior to the XML Declaration.

17
Processing Instructions
  • Markup that provides information to be used by
    software applications.
  • The first entry after the refers to the application for which the
    instruction is intended.
  • The second entry tells the application exactly
    what to do.

18
Rules Review
  • All tags must be properly terminated with an end
    tag, like this .
  • Tag names are case-sensitive. The following would
    generate an error .
  • Empty tags may be defined as well and can be
    expressed in one of two ways or
    .
  • Tag data should always be enclosed in matching
    single or double quotes.
  • The construct of tag, data, and end tag is
    referred to as an element.
  • An element may contain other elements, as long as
    the end tags of the contained elements come
    before the end tag of the containing element.
  • Every XML document must have only one root
    element that contains all other elements in the
    document.
  • Comments are ignored by the parser and are
    enclosed in comment tags .

19
Review this Session
  • What is an XML Document?
  • The Prolog of an XML Document
  • Elements
  • Attributes
  • Comments
  • Processing Instructions

20
Build a Complete XML Document
  • You have been given a menu for a menu for a cafe.
    Create an XML document that represents that menu.
Write a Comment
User Comments (0)
About PowerShow.com