Dr' Maria Indrawan maria'indrawaninfotech'monash'edu'au - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

Dr' Maria Indrawan maria'indrawaninfotech'monash'edu'au

Description:

www.monash.edu.au. 2. XML Document an Example bookshop book title Harry Potter and the Sorcerer's Stone /title author initials J.K /initials ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 34
Provided by: Rise2
Category:

less

Transcript and Presenter's Notes

Title: Dr' Maria Indrawan maria'indrawaninfotech'monash'edu'au


1
Dr. Maria Indrawanmaria.indrawan_at_infotech.monash.
edu.au
  • XML An Introduction

2
XML Document an Example
  • ltbookshopgt
  • ltbookgt
  • lttitlegt Harry Potter and the Sorcerers
    Stonelt/titlegt
  • ltauthorgt
  • ltinitialsgtJ.Klt/initialsgt
  • ltsurnamegt Rowlinglt/surnamegt
  • lt/authorgt
  • ltprice value16.95gtlt/pricegt
  • lt/bookgt
  • lt/bookshopgt

3
What is XML
  • XMLExtensible Markup Language.
  • XML is a way to represent data gt data structure
  • Utilise the mark ups to define
  • structure
  • semantics gt to a certain level.
  • Markup Languages
  • HTML
  • SGML
  • WWW Consortium(W3C) recommendation.
  • www.w3c.org

4
HTML vs XML
5
Why do we need XML?
  • Distributed applications need to share data.
  • XML allow data to be shared across distributed
    application because
  • The underlying data format is plain text.
  • The structure and the meaning of the data can be
    tightly defined.
  • The need to support different format of
    presentation. (eg. mobile phone, PDA, web,
    printed materials).
  • Unlike HTML, XMLs markups concerned with the
    structure and the meaning of the data itself.
  • Presentation is dealt by querying and
    manipulating the XML document through the use of
    manipulation language such as XSL.
  • Separation of data and presentation.

6
Some XML Related Technologies
  • DTD and XSD
  • Data definition.
  • XSL (XSLT and XSL-FO)
  • Presentation.
  • XPath
  • Navigating the XML document.
  • Xlink, Xpointer
  • Linking elements within XML document or between
    XML documents.
  • DOM and SAX
  • APIs to manipulate XML document.

7
XML in Web Browser
  • To display an xml document in a web browser, the
    web browser needs to have an XML Parser.
  • Example msxml

8
XML Parser
  • A parser is required to read and manipulate XML
    documents.
  • What is a parser?
  • Parse in linguistic means to divide language into
    smaller parts that can be analyzed webopedia.
  • What does an XML parser do?
  • Read the XML documents as a plain text and
    transform it into a data structure, typically
    tree, in the memory.
  • The applications, such as web browser, access the
    data structure and process the data according to
    their objectives.

9
Current Usage of XML (1)
  • XML as a data transport or communication platform
  • Interoperability
  • Web Services
  • WSDL, SOAP, UDDI
  • Workflow
  • BPEL4WS
  • Semantic support
  • Semantic Web
  • RDF
  • Both interoperability and semantic support
  • Semantic Web services
  • OWL(Web Ontology Language)
  • Agent Technology
  • DAML(DARPA Agent Markup Language ).

10
Current Usage of XML (2)
  • XML as a database
  • Native XML database
  • Tamino
  • XML-Relational Hybrid
  • Oracle
  • DB2
  • Issues for using XML as a native database
  • Lack of formal theory in describing the model.
  • The concept of relations
  • Data Integrity
  • Transaction

11
XML Issues
  • Processing
  • Text vs binary processing
  • Security

12
XML Document Basic Components
  • Elements.
  • Attributes.
  • Character and Entity References.
  • Character Data (CDATA).
  • Processing Instruction.
  • Comments.

13
Elements
Root Element (compulsory)
Branch Elements
attribute
Leaf Element
14
Element
  • The basic building block of XML markups.
  • It may contains
  • Text
  • Other elements (child elements)
  • Attributes
  • Character Data
  • Other markup, eg comments
  • Delimited with a start-tag and an end-tag.
  • Element can be empty.
  • The end-tag CANNOT be omitted as in HTML.
  • Each tag must consist a valid element type name.

15
Elements Name
  • Elements Name (Tags name) is CASE SENSITIVE.
  • ltBOOKgt ?ltBookgt?ltbookgt
  • Trailing space is legal but will be ignored
  • ltBOOK gt ltBOOKgt

16
Empty Element
  • Has no content.
  • May be associated with attribute.
  • Example
  • ltimg srclogo.pnggtlt/imggt
  • can be abbreviated into
  • ltimg srclogo.png/gt

17
XML Document Basic Components
  • Elements.
  • Attributes.
  • Character and Entity References.
  • Character Data (CDATA).
  • Processing Instruction.
  • Comments.

18
Attributes
  • Information regarding the element.
  • If elements are nouns of XML then attributes
    are its adjective.
  • lttagname attribute_nameattribute_valuegt

19
Attributes vs Element
  • Determine by the semantic contents.
  • Attributes are characteristics of an element.

20
XML Document Basic Components
  • Elements.
  • Attributes.
  • Character and Entity References.
  • Character Data (CDATA).
  • Processing Instruction.
  • Comments.

21
Character References
  • Use to display characters that are not supported
    by the input device (keyboard).
  • entering using US-ASCII keyboard.
  • Format NNNNN or xXXXX
  • N decimal
  • X hexadecimal
  • Example gt 36 OR x24

22
Entity References
  • Entities may be defined and used for
  • Representing character used in mark-up
  • lt lt
  • amp
  • String
  • IR Information Retrieval
  • Predefined entities lt, gt, quot, etc

23
XML Document Basic Components
  • Elements.
  • Attributes.
  • Character and Entity References.
  • Character Data (CDATA).
  • Processing Instruction.
  • Comments.

24
Character Data
  • To escape blocks of text containing characters
    which would otherwise be recognized as markup.
  • lt!CDATAgt
  • lt!CDATAltgreetinggtHello, world!lt/greetinggtgt

25
Character Data(2)
  • ltexamplegt
  • lt!CDATAWarn-Disclaimerltcopy 2001
    PMgtgt
  • lt/examplegt
  • ltexamplegt
  • ampWarn-ampDisclaimerampltampcopy
    2001 ampPM ampgtgt
  • lt/examplegt

26
XML Document Basic Components
  • Elements.
  • Attributes.
  • Character and Entity References.
  • Character Data (CDATA).
  • Processing Instruction.
  • Comments.

27
Processing Instruction(PI)
  • Processing instructions (PIs) allow documents to
    contain instructions for applications.
  • lt?target instruction ?gt
  • Target is used to identify the application or
    other object to which the PI is directed.
  • lt?xml-stylesheet hrefmystyle.css
    typetext/cssgt

28
XML Document Basic Components
  • Elements.
  • Attributes.
  • Character and Entity References.
  • Character Data (CDATA).
  • Processing Instruction.
  • Comments.

29
Comments
  • Syntax
  • lt!- comment text --gt
  • Comments cannot be used within element tags.
  • lttaggt some content lttag lt! it is illegal --gtgt
  • Comments may never be nested.
  • lt! Comments cannot lt! be nested --gt like this
    --gt

30
Structure of XML Document
  • XML document has to be well-formed.
  • Conform to syntax requirements
  • Conform to a simple container structure
  • Common structure of XML document
  • Prologue
  • Body
  • Epilogue

31
Prologue
  • Includes
  • XML Declaration
  • lt?xml version1.0 encodingutf-8
    standaloneyesgt
  • Version is mandatory, encoding and standalone are
    optional
  • Document Type Declaration
  • lt!DOCTYPE
  • It is not DTDDocument Type Definition
  • A simple well-formed XML does not need it.
  • Schema declaration

32
Body Epilogue
  • Body
  • Contains 1 or more elements
  • The contents
  • Epilogue
  • Hardly used
  • Can be used to identify end of document

33
Well-formed XML Document
  • Contains one root element.
  • All the tags have a valid tags name.
  • There is no overlapping tags.
Write a Comment
User Comments (0)
About PowerShow.com