XML - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

XML

Description:

actuate: Indicates when a link should be displayed ... Can specify different combinations of show and actuate to get different behavior. ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 22
Provided by: Suka8
Category:
Tags: xml | actuate

less

Transcript and Presenter's Notes

Title: XML


1
XML
8
  • 6.8 XLink and XMLQuery

2
Links
  • Power of Web lies in the links
  • How are HTML links specified?
  • lta hrefURLgt
  • Clicking on contents replaces document.
  • Support for going to a specific part of that
    document.
  • lta namesection3gt
  • lta hrefdocument.htmlsection3gt
  • ltimg srcURLgt
  • Image data retrieved and rendered.
  • ltlinkgt
  • Used in document head for stylesheets, etc.

3
Limitations
  • What are the limitations of HTML linking?
  • Unidirectional
  • Requires write permission to create a named
    anchor.
  • Semantics predefined by link type.
  • Existence of link implied by element name
  • No way to add linking as a capability of linking
    to other elements.

4
Starting from scratch
  • Problem
  • Create a mechanism for linking XML documents.
  • What is the first thing we should do?
  • Define linking

5
Defining link
  • XLink developers came up with the following
  • Explicit relationship between resources or
    portions of resources.
  • What is the significance of explicit?
  • Are links in HTML explicit?
  • Now what?
  • Define relationship.
  • Define resources.
  • Define portion.

6
Defining relationship
  • What kinds of relationships might we want to
    capture with a link?
  • One to one
  • A links to B
  • A is linked from B
  • A links to B and vice versa
  • Many to one
  • One to many
  • Many to many

7
Defining Resource
  • How are resources identified on the Web?
  • URI / URLs
  • How about portions?
  • Need a way to address part of parts of a web
    resource.
  • What might we do with XML?
  • Address portions relative to XML structure.
  • 3rd child element of the root element.
  • 1st occurrence of ltbookgt element
  • Text of 2nd ltpgt element in 3rd ltchaptergt element
  • XPointer is a language for specifying these kinds
    of addresses.

8
Implementing links
  • We know what we want to do, how do we do it?
  • Invent a set of tags that specify links.
  • Is there a better way?
  • Think back to definition of a link
  • Explicit relationship between resources or
    portions of resources.
  • Links are properties of something within a
    document.
  • Source data for an image.
  • Destination of a hyperlink.

9
XLink
  • Namespace URI
  • http//www.w3.org/1999/xlink
  • Defines a set of attributes which have specific
    linking semantics.
  • type, href, role, arcrole, title, show, actuate,
    label, from, to
  • The type attribute is required
  • simple, extended, locator, arc, resource, title
  • Other attributes are either required, optional,
    or non-sensical depending on type.

10
Simple Links
  • typesimple
  • Indicates that the element where this attribute
    is specified is associated with a simple link.
  • Unidirectional
  • Meaning of other attributes
  • href URI of link target.
  • show Indicates how a link should be displayed.
  • Valid values new, replace, embed, other, or
    none.
  • actuate Indicates when a link should be
    displayed
  • Valid values onLoad, onRequest, other, or none

11
Comparing with HTML
  • In HTML
  • lta hrefhttp//www.espn.comgtLink to ESPNlt/agt
  • With XLink
  • lta xmlnsxlinkhttp//www.w3.org/1999/XLink
    xlinktypesimple xlinkhrefhttp//www.espn.co
    m xlinkshowreplace xlinkactuateonReque
    stgt

12
Comparing with HTML
  • In HTML
  • ltimg srcfile.jpggt
  • With XLink
  • ltimg xmlnsxlinkhttp//www.w3.org/1999/XLink
    xlinktypesimple xlinkhreffile.jp
    g xlinkshowembed
    xlinkactuateonLoadgt

13
Advantages over HTML
  • Can add linking capabilities to any element (not
    just ltagt and ltimggt like in HTML).
  • Can specify different combinations of show and
    actuate to get different behavior.
  • No longer a single behavior associated with the
    specific element type.

14
Extended Links
  • Advanced features of XLink is in extended link
    types.
  • xlinktype extended
  • Collects together children that may be labeled as
    arc, locator, or resources.
  • These arcs, locators, and resources collectively
    define the extended link.

15
Resource
  • xlinktype resource
  • Identifies a local resource that may be involved
    in an extended link.
  • Other attributes that go along
  • xlinktitle Human readable tag/title.
  • xlinklabel Used by arcs.

16
Locator
  • xlinktypelocator
  • Identifies a remote resource that may be involved
    in an extended link.
  • Other attributes that go along
  • xlinktitle Human readable tag/title.
  • xlinklabel Used by arcs.
  • xlinkhref Location of resource (required)

17
Arc
  • xlinktypearc
  • Connects two resources
  • Associated attributes
  • xlinkfrom Label of starting resource
  • xlinkto Label of ending resource
  • xlinkshow Governs display
  • xlinkactuate Governs when to display

18
Browser support for XLink
  • Currently extremely limited
  • Netscape 6 supports simple links
  • Amaya supports simple links
  • Several experimental link processor and
    linkbase products based on XLinks.

19
Addressing Document Portions
  • Didnt talk about addressing portions of
    document.
  • XPointer is a language for addressing a portion
    of a document.
  • Allows you to construct expressions which
    identify portions or ranges of XML documents.
  • Built on top of XPath
  • Add XPointer expressions at the end of any URL
    using xpointer
  • Example
  • booklist.xmlxpointer(/booklist/book3/title/text
    ())

20
XML vs Database
  • When would we want to store info. as a collection
    of XML documents instead of in a database?
  • Info is structured but not regular.
  • Need/want to be document-centric.
  • Need extensibility.
  • What do we give up by not having a database?
  • Query language.

21
XMLQuery
  • Provide database like query facilities to
    collections of XML data.
  • Relatively new effort by W3C
  • Still being defined.
  • Uses XPath to address into document structure
  • Demo http//xqueryservices.com
Write a Comment
User Comments (0)
About PowerShow.com