Introduction to XML - PowerPoint PPT Presentation

1 / 38
About This Presentation
Title:

Introduction to XML

Description:

List and explain drawbacks of HTML. Discuss the ... NAME KATE WINSLET /NAME NAME NICOLE KIDMAN /NAME NAME ARNOLD /NAME NAME TOM CRUISE /NAME ... – PowerPoint PPT presentation

Number of Views:112
Avg rating:3.0/5.0
Slides: 39
Provided by: bhai
Category:

less

Transcript and Presenter's Notes

Title: Introduction to XML


1
Introduction to XML
  • Chapter 1

2
Chapter Objectives -1
  • Discuss markup language
  • List and explain drawbacks of HTML
  • Discuss the architecture of XML documents
  • List the benefits of XML
  • Discuss Parser

3
Chapter Objectives -2
  • Build a complete XML Document
  • Character Data
  • Comments
  • Processing Instructions
  • Entities
  • General Entities
  • Parameter Entities
  • The DOCTYPE Declarations

4
History of Markup
Documents recorded using paper and pen
Typesetters formatting documents
Tools used by typesetters to format a document
5
Markup Language
  • A Markup language defines the rules that help to
    add meaning to the content and structure of
    documents.
  • They are classified as
  • Stylistic Markup It determines the presentation
    of the document
  • Structure Markup It defines the structure of
    the document
  • Semantic Markup It determines the content of
    the document

6
SGML
  • Generalized Markup Language (GML) is the system
    of formatting documents.
  • GML was fine-tuned and came to be known as
    Standard Generalized Markup Language (SGML).
  • SGML is the source of origin of all markup
    languages

7
Features of SGML
  • It describes markup language, which allows
    authors to create their own tags that relate to
    their content.
  • It needs a separate file that will contain all
    the rules for the language, for its
    interpretation
  • A SGML application is markup language derived
    from SGML.

8
HTML
  • HTML is the most famous markup language derived
    from SGML.
  • It was created to mark up technical papers so
    that they could be transferred across different
    platforms for the scientific community.
  • It is now also used by those non-scientific users
    who are concerned about their documents
    presentation.

9
Drawbacks of HTML
  • Fixed tag set
  • Presentation technology does not relate to the
    contents
  • It is flat
  • Clogging
  • HTML is not international
  • Data interchange is impossible
  • Does not have a robust linking mechanism
  • HTML is not reusable

10
HTML and XML code Examples
XML Code
HTML Code
    • TOM CRUISE
      • CLIENT ID 100
      • COMPANY XYZ Corp.
      • Email tom_at_usa.net
      • Phone 3336767
      • Street Adress 25th St.
      • City Toronto
      • State Toronto
      • Zip 20056
  • TOM CRUISE
  • 100
  • XYZ Corp.
  • tom_at_usa.net
  • 3336767
  • 25th St.
  • Toronto
  • Toronto
  • 20056

11
XML -1
  • XML stands for Extensible Markup Language.
  • It overcomes all the drawbacks of HTML.
  • It allows the user to define their own set of
    tags, and also makes it possible for others to
    understand it.
  • It is more flexible than HTML.
  • It inherits the features of SGML and combines it
    with the features of HTML.
  • It is a smaller version of SGML.

12
XML -2
  • XML is a metalanguage and it describes other
    languages.
  • The data contained in an XML file can be
    displayed in different ways.
  • It can also be offered to other applications for
    further processing.
  • Style sheets help transform structured data into
    different HTML views. This enables data to be
    displayed on different browsers.

13
XML Architecture - 1
  • XML supports three-tier architecture for handling
    and manipulating data.
  • It can be generated from existing databases using
    a scalable three-tier model.
  • XML tags represent the logical structure of data
    that can be interpreted and used in various ways
    by different applications.
  • The middle-tier is used to access multiple
    databases and translate data into XML.

14
XML Architecture -2
15
XML A Universal data format
  • HTML is a single markup language, but XML is a
    family of markup languages.
  • Any type of data can be easily defined in XML.
  • XML is popular because it supports a wide range
    of applications and is easy to use.
  • XML has a structured data format, which allows it
    to store complex data

16
Benefits of XML
  • The three-tier architecture has easier
    scalability and better security.
  • The benefits of XML are classified into the
    following
  • Business benefits
  • Technological benefits

17
Business Benefits
  • Information sharing
  • Allows businesses to define data formats in XML
  • Provides tools to read, write and transform data
    between XML and other formats
  • XML inside a single application
  • Powerful, flexible and extensible language
  • Content Delivery
  • Supports different users and channels, like
    digital TV, phone, web and multimedia kiosks

18
Technological Benefits
Separation of data and presentation
Extensibility
Technological Benefits
Semantic information
Re-use of data
19
XML Advantages
  • Eases information exchange
  • License free
  • Platform independence
  • Output format independence
  • Application independence
  • Built-in internationalization
  • No fixed set of markup tags

20
XML Document Structure
  • An XML document is composed of sets of entities
    identified by unique names.
  • All documents begin with a root or document
    entity.
  • Entities are aliases for more complex functions.
  • Documents are logically composed of declarations,
    elements, comments, character references, and
    processing instructions.

21
Well formed and Valid Documents
  • An XML document is considered as well formed, if
    a minimum set of requirements defined in the XML
    1.0 specification are satisfied.
  • The requirements ensure that correct language
    terms are used in the right manner .
  • A valid XML document is a well-formed XML
    document, which conforms to the rules of a
    Document Type Definition (DTD).
  • DTD defines the rules that an XML markup in the
    XML document must follow.

22
Parsers - 1
  • Parsers help the computer interpret an XML file.
  • Their are two types of parsers
  • Non Validating parser
  • Validating parser

23
Parsers - 2
Data tree
24
Creating an XML Document
  • To create an XML document
  • State an XML declaration
  • Create a root element
  • Create the XML code
  • Verify the document

25
Stating an XML Declaration
  • Syntax

encodingUTF-8?
  • Standalone and encoding attributes are
    optional, only the version number is mandatory
  • Standalone is the external declaration
  • Encoding - specifies the character encoding
    used by the author
  • XML 1.0 version is default

26
Creating a Root Element
  • There can only be one root element
  • It describes the function of the document
  • Every XML document must have a root element

Example encodingUTP-8?
27
Creating the XML Code
  • It is the process of creating our own elements
    and attributes as required by our application.
  • Elements are the basic units of XML content.
  • Tags tell the user agent to do something to the
    content encased between the start and end tag.

Opening Tag Content Closing Tag

Aptech Ltd
Parts of an element
Element
28
Comments
  • This is information for the understanding of the
    user, and is to be ignored by the processor.
  • Syntax

The example given will display only the name TOM
CRUSIE, and others are treated as comments.
Example TOM
CRUISE
29
Processing Instruction
  • A processing information is a bit of information
    meant for the application using the XML document.
  • These instructions are directly passed to the
    application using the parser.
  • The XML declaration is also a processing agent.


Instruction information
Name of application
30
Character Data
  • The text between the start and end tags is
    defined as character data.
  • Character data may be any legal (Unicode).
  • Character data is classified into
  • PCDATA
  • CDATA

31
PCDATA
  • It stands for parsed character data.
  • PCDATA is text that will be parsed by a Parser.
  • Tags inside the text will be treated as markup
    and entities will be expanded.

Predefined entities
 
32
CDATA
  • It means character data.
  • It will not be parsed by the Parser.
  • CDATA are used to make it convenient to include
    large blocks of special characters.
  • The character string is not allowed within a
    CDATA block as it will signal the end of the
    CDATA block.

TOM
CRUISE tom_at_usa.com

Example
33
Entities
  • Entities are used to avoid typing long pieces of
    text repeatedly within a document.
  • There are two categories of entities
  • General entities
  • Syntax
  • by an entity"
  • Parameter entities
  • Syntax
  • represented by an entity"

34
Examples of Entities
  • An example of Parameter entities
  • QUANTITY "15"
  • Entity declaration
  • Syntax
  • PARAMETER_ENTITY_NAME
  • Example
  • address
  • An example of a General entity
  • Suite 12 Paris, France"
  • Entity declaration
  • Syntax
  • ENTITY_NAME
  • Example
  • address

35
The DOCTYPE declarations
  • The declaration follows the XML
    declaration in an XML document.
  • Syntax
  • ...declare the entities here....
  • ...body of the document....

Example firstFloor "15 Downing St Floor 1" secondFloor "15 Downing St Floor 2" thirdFloor "15 Downing St Floor 3"
36
Attributes
  • An attribute gives information about an element.
  • Attributes are embedded in the element start tag.
  • An attribute consists of an attribute name and
    attribute value.

Example SONY count"10"IBM
37
XML Well-formed rules
  • 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 element
  • Attribute values must always be quoted

38
XML Element Naming
  • 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
Write a Comment
User Comments (0)
About PowerShow.com