XML Extensible Markup Language - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

XML Extensible Markup Language

Description:

ISO Standard, 1986, for data storage & exchange. Metalanguage for ... Also make sure there are no spaces or line breaks inside the ']] ' string. script ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 27
Provided by: soni116
Category:

less

Transcript and Presenter's Notes

Title: XML Extensible Markup Language


1
XML Extensible Markup Language
  • protocols ?

2
Markup
  • 1. Stylistic how a document is presented
  • ltBgtltUgtltIgt
  • 2. Structural how the document is to be
    structured
  • ltHRgtltDIVgt
  • 3. Semantic tell about the content of data.
  • ltHEADgtltTITLEgt

3
Some History
  • SGML (Standard Generalized Markup Language)
  • ISO Standard, 1986, for data storage exchange
  • Metalanguage for defining languages (through
    DTDs)
  • A famous SGML language HTML!!
  • Separation of content and display
  • Used in U.S. gvt. contractors, large
    manufacturing companies, technical info.
    Publishers,...
  • SGML reference is 600 pages long
  • XML (eXtensible Markup Language)
  • W3C (World Wide Web Consortium) --
    http//www.w3.org/XML/ recommendation in 1998
  • Simple subset (80/20 rule) of SGML ASCII of
    the Web, Semantic Web
  • XML specification is 26 pages long

4
SGML XML HTML
  • SGML provides arbitrary structure. Full SGML
    systems solve large, complex problems that
    justify their expense.
  • XML is defined as an application profile of SGML,
    or roughly speaking, a restricted form of SGML.
    XML specifies neither semantics nor a tag set.
    XML provides a facility to define tags and the
    structural relationships between them.
  • In HTML, both the tag semantics and the tag set
    are fixed.

5
The main difference between XML and HTML
  • XML was designed to carry data.
  • XML is not a replacement for HTML.XML and HTML
    were designed with different goals
  • XML was designed to describe data and to focus on
    what data is.HTML was designed to display data
    and to focus on how data looks.
  • HTML is about displaying information, while XML
    is about describing information

6
XML is ...
  • ... an eXtensible Markup Language
  • ... HTML ? presentation tags your-own-tags
  • ... a meta-language for defining other languages
  • ... a semistructured data model
  • ... not a data model but just an exchange syntax
  • ... many good (and some bad) Computer Science
    ideas reinvented (but now for the masses!)
  • ... good old constant change

7
XML as a Self-Describing Data Exchange Format
  • can be easily understood by our friend (...
    even using CP/M edlin)
  • can be parsed easily
  • contains its own structure (parse tree) in the
    data
  • gt allows the application programmer to
    rediscover schema and content/semantics (to
    which extent???)
  • may include an explicit schema description
    (e.g., DTD)
  • gt meta-language definition of a language w.r.t.
    which it is valid
  • allows separation of marked-up content from
    presentation (gtstyle sheets)
  • many tools (and many more to come -- (re)use
    code) parsers, validators, query languages,
    storage,
  • standards (good for interoperation, integration,
    etc)
  • gt generic standards (XML, DTDs, XML Schema,
    XPath,...)
  • gt community/industry standards (specific markup
    languages)

8
10 Commandmends of XML
  • XML shall be straightforwardly usable over the
    Internet.
  • XML shall support a wide variety of applications.
  • XML shall be compatible with SGML.
  • It shall be easy to write programs which process
    XML documents.
  • The number of optional features in XML is to be
    kept to the absolute minimum, ideally zero.
  • XML documents should be human-legible and
    reasonably clear.
  • The XML design should be prepared quickly.
  • The design of XML shall be formal and concise.
  • XML documents shall be easy to create.
  • Terseness in XML markup is of minimal importance.

9
  • The XML declaration
  • The Document Type Declaration
  • The element data
  • The attribute data
  • The character data or XML content

10
XML Declaration
  • lt?xml
  • version1.0
  • standalonexxx yes/no
  • encodexxx big-5, US-ASCII
  • UTF-8

11
  • lt?xml version"1.0" encoding"ISO-8859-1"?gt
  • ltnotegt
  • lttogtTovelt/togt
  • ltfromgtJanilt/fromgt
  • ltheadinggtReminderlt/headinggt
  • ltbodygtDon't forget me this weekend!lt/bodygt
  • lt/notegt

12
Internet Explorer 6
  • Internet Explorer 6 has full XML support,
    including Namespaces, Style sheets in CSS, and
    XSLT 1.0.
  • The built-in XML Parser 3.0 in Internet Explorer
    6.0 and Windows XP is based on both the W3C XSLT
    1.0 and the W3C XPath 1.0 Recommendations

13
  • Internet Explorer has the following XML support
  • Viewing of XML documents
  • Full support for W3C DTD standards
  • XML embedded in HTML as Data Islands
  • Binding XML data to HTML elements
  • Transforming and displaying XML with XSL
  • Displaying XML with CSS
  • Access to the XML DOM
  • Internet Explorer also has support for Behaviors
  • Behaviors is a Microsoft-only technology  
  • Behaviors can separate scripts from an HTML page.
  • Behaviors can store XML data on the client's
    disk.

14
Root Element
  • ltnotegt
  • Child elements of root element
  • lttogtTovelt/togt
  • ltfromgtJanilt/fromgt ltheadinggtReminderlt/headinggt
    ltbodygtDon't forget me thisweekend!lt/bodygt
  • All XML documents must have a root element

15
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, etc)
  • Names cannot contain spaces

16
Comments in XML
  • The syntax for writing comments in XML is similar
    to that of HTML.
  • lt!-- This is a comment --gt

17
attributes
  • ltbookgt lttitlegtMy First XMLlt/titlegt ltprod
    id"33-657" media"paper"gtlt/prodgt
  • lt/bookgt
  • the prod element has attributes. The attribute
    named id has the value "33-657". The attribute
    named media has the value "paper". 
  • Attribute values must always be quoted

18
  • ltperson sex"female"gt ltfirstnamegtAnnalt/firstnamegt
    ltlastnamegtSmithlt/lastnamegt
  • lt/persongt
  • ltpersongt
  • ltsexgtfemalelt/sexgt ltfirstnamegtAnnalt/firstnamegt
    ltlastnamegtSmithlt/lastnamegt
  • lt/persongt

19
XML Validation
  • XML with correct syntax is Well Formed XML.
  • Errors in XML documents will stop the XML program

20
All XML elements must have a closing tag.
  • With XML, it is illegal to omit the closing tag.
  • ltpgtThis is a paragraph
  • ltpgtThis is a paragraphlt/pgt

21
All XML elements must be properly nested
  • Improper nesting of tags makes no sense to XML.
  • ltbgtltigtThis text is bold and italiclt/bgtlt/igt
  • ltbgtltigtThis text is bold and italiclt/igtlt/bgt

22
XML tags are case sensitive
  • ltMessagegtThis is incorrectlt/messagegt
  • ltmessagegtThis is correctlt/messagegt

23
Escape Characters
  • Illegal XML characters have to be replaced by
    entity references
  • ltmessagegtif salary lt 1000 thenlt/messagegt
  • ltmessagegtif salary lt 1000 thenlt/messagegt

24
  • There are 5 predefined entity references in XML
  • ltlt less than
  • gtgt greater than
  • amp ampersand 
  • apos apostrophe
  • quot quotation mark
  • Note Only the characters "lt" and "" are
    strictly illegal in XML. Apostrophes, quotation
    marks and greater than signs are legal, but it is
    a good habit to replace them.

25
CDATA (Character data)
  • Everything inside a CDATA section is ignored by
    the XML processor
  • Contents will pass to application
  • A CDATA section starts with "lt!CDATA" and ends
    with "gt"
  • A CDATA section cannot contain the string "gt",
    therefore, nested CDATA sections are not allowed.
  • Also make sure there are no spaces or line breaks
    inside the "gt" string.

26
  • ltscriptgt
  • lt!CDATA
  • function matchwo(a,b)
  • if (a lt b a lt 0)
  • then return 1
  • else return 0
  • gt
  • lt/scriptgt
Write a Comment
User Comments (0)
About PowerShow.com