XML Part 5: XLL: The Extensible Linking Language - PowerPoint PPT Presentation

1 / 52
About This Presentation
Title:

XML Part 5: XLL: The Extensible Linking Language

Description:

actuate. auto - link is automatically traversed. user - link is traversed by user action ... actuate (auto|user) #IMPLIED. behavior CDATA #IMPLIED. content ... – PowerPoint PPT presentation

Number of Views:76
Avg rating:3.0/5.0
Slides: 53
Provided by: serv385
Category:

less

Transcript and Presenter's Notes

Title: XML Part 5: XLL: The Extensible Linking Language


1
XML Part 5 XLL The Extensible Linking Language
  • World Wide Web Technology

2
XLL The Extensible Linking Language
  • XLL has now been divided into two parts
  • Xlink deals with the constructs that describe
    links between objects
  • Xpointer describes how fragments of a document
    are addressed

3
XLink
  • What is a Link?
  • A link is an explicit relationship between two or
    more data objects or portions of data objects
  • Xlink has its origins in HTML, HyTime and TEI
    (Text Encoding Initiative)
  • For interoperability with HTMLmany constructs are
    similar

4
Links in HTML
  • A very simple link type expressed in only 2
    elements ltAgt and ltLINKgt
  • The link is expressed at one of its ends (with an
    A element)
  • Users can only initiate travel from that end to
    the other
  • The behaviour on link traversal is principally
    determined by the browser
  • The link goes to only one destination

5
Link Elements
  • Existence of a link is asserted by a linking
    element
  • In HTML, simply ltAgt or ltLINKgt are reserved
  • In XML, this is not appropriate because element
    types are extensible. So instead, link elements
    are indicated by the presence of an attribute
    xmllink

6
Link Elements
  • Possible values of xmllink are
  • simple
  • extended
  • locator
  • group
  • document
  • An element with xmllink set to one of these is
    treated as an element of the indicated link type

7
Example
  • ltA xmllinksimple hrefhttp//www.w3.org/gt
    The W3Clt/Agt
  • asserts a simple link
  • Not it is not the type A that asserts the link,
    but the xmllink attribute

8
Locators
  • What are locators?
  • Are data which identify a resource.
  • For documents such locators are normally URIs
  • For fragments of documents
  • recall the target and in HTML
  • Xpointers can be used to specify more specific
    resources such as a fragment of a document

9
Connectors
  • The resource being located is often termed the
    designated resource.
  • The designated resource may be a subresource of a
    resource called the containing resource
  • The latter is addressed using a URI.
  • The subresource is addressed using an XPointer

10
Whole document addressed using URI
Doc ltgtfragment resourceltgt
Subresource addressed using XPointer
11
Connectors
  • Subresource
  • URIXpointer
  • URIXpointer
  • The connector means that the extraction is to
    be done client side
  • The connector means that nothing is said about
    whether the extraction is to be server or client
    side. If a URI is not provided, the containing
    resource is considered to be the document
    containing the linking element

12
Queries
  • A URI by definition, includes an optional query
    component.
  • Where this component is used to indicate via an
    Xpointer, a subresource to be extracted on the
    server side, the query should take the form
  • URI?XML-XPTRXPointer

13
Types of Links
  • Inline link
  • indicated by a linking element that serves as one
    of its own resources eg ltAgt HTML
  • Out-of-line link
  • indicated by a linking element that does not
    serve as one of its own resources (may be in none
    of the resources it connects)
  • Multidirectional link
  • Traversed at more than one of its resources
  • Links to multiple resources

14
Types of Linking Element
  • Simple link
  • usually inline and always one-directional
  • Extended link
  • more general

15
Example
Resource which is an addressable unit nasg XML
Locator
  • lta NAMElink14 HREFhttp//www.somesite/pub/doc
    4.htmlchap4gt
  • points to an ltagt element in the document
    doc4.html lta NAMEchap4gt The targetlt/agt

Linking element
16
Other Attributes a link element can specify
  • href - locator
  • inline - whether the content is a resource of the
    link
  • role - role of the remote resource
  • title - title of the renote resource
  • content-role - role of the local resource
  • content-title - title of local resource

Meaning eg. Bib, thesaurii
17
Link Behaviour
  • show
  • new - resource displayed in new window
  • replace - replace displayed in same window
  • embed - resource embedded
  • actuate
  • auto - link is automatically traversed
  • user - link is traversed by user action
  • behavoir

18
Simple Link Declaration
  • lt!ELEMENT MySimpleLink ANYgt
  • lt!ATTLIST MySimpleLink xmllink CDATA FIXED
    Simple href CDATA REQUIRED
    inline (truefalse) true role CDATA IMPLIED
    title CDATA IMPLIED show (embedreplacenew)
    IMPLIED actuate (autouser) IMPLIED
    behavior CDATA IMPLIED content-roleCDATA IMPL
    IED content-title CDATA IMPLIED

19
Simple Link
  • ltASimpleLink hrefhttp//www.somesite.com/diction
    ary/ shownew content-roleterm
    roledefinitiongtXMLlt/ASimpleLinkgt
  • Simple links can be out-of-line

20
Extended Links
  • ltAnExtended inlinefalsegt ltALocator
    hrefsmith.xml roleEssay/gt ltAlocator
    hrefjones.xml roleRebuttal/gtlt/AnExtendedgt
  • ltAnExtended inlinetruegt ltAnimalgtKangaroolt/Anim
    algt ltAlocator hrefkangaroo.gif rolePhoto
    shownew/gt ltAlocator hrefkangaroo.xml
    roleDescription shownew/gtlt/AnExtendedgt

21
Extended Link Groups
  • In the first extended link example,
    multidirectional links were asserted out of line.
  • In such cases, it is useful for applications to
    know the documents that together constitute an
    interlinked group
  • An extended link group may be used to store a
    list of links to other documents that make up
    such a group.

22
Extended Link Groups
Each is a link
  • lt!ELEMENT MyGroup (MyDocument)gtlt!ATTLIST
    MyGroup xmllink CDATA FIXED group steps
    CDATA IMPLIEDgtlt!ELEMENT MyDocument
    EMPTYgtlt!ATTLIST MyDocumentxmllink CDATA
    FIXED documenthref CDATA REQUIREDgt

23
Attribute Remapping
  • Sometimes attributes like role might clash with
    attributes otherwise defined for the element used
    as a linking element.
  • For example, considerltperson rolePresentergtHi
    llary Clintonlt/persongt
  • If we wanted to make this element a simple link
    to another document, we have a problem in that
    role is already used.

24
Attribute remapping
  • Xlink gets around this problem by letting you
    remap attribute names
  • lt!ATTLIST person xmllink CDATA FIXED simple
    xmlattributes CDATA FIXED role LinkRole href
    CDATA REQUIREDgt
  • This means that within person elements, the
    attribute LinkRole is used in place of role

25
Attribute Remapping
  • ltperson rolePresenter LinkRoleHomePagehref
    http//www.somesite.com/jlygt JJYlt/persongt

26
XPointer
  • What is an address?
  • Often refers to a physical loocation
  • An address in a general sense is any structured
    expression that helps to locate a particular
    object

27
Locators
  • Data which identify a resource.
  • Normally URIs
  • Xpointers can be used in conjunction with URIs to
    specify a more specific resource
  • a fragment of a document

28
Fragments in HTML
  • followed by a string of characters is the
    fragment identifier in HTML
  • In the target document, the fragment is indicated
    by an ltAgt element with an attribute NAME matching
    the fragment identifier

29
Extended Pointers
  • URI provides a means of addressing any document
    on the web
  • an Xpointer provides a means for addressing any
    element or string of textual content in a given
    document
  • URI identifies the containing resource
  • Xpointer identifies the designated resource

30
Documents as trees
MEMO
TO
FROM
MESSAGE
31
Documents as trees
Root
MEMO
Parent
Child
TO
FROM
MESSAGE
Sibling
32
Location Terms
  • Absolute terms
  • Relative terms
  • Span terms
  • Attribute Terms
  • String Data Terms

33
Xpointer Structure
MEMO
Root()
Child(1)
TO
FROM
MESSAGE
root().child(1)
34
Xpointer Structure
  • Root() is an example of an absolute location term
  • child(1) is an example of a relative location
    term
  • It selects an element on the basis of its
    relationship with a location resource expressed
    in the preceding part of XPointer

35
Absolute Location Terms
  • root() - the root of the document (assumed if no
    absolute term)
  • origin() - the element asserting the link (the
    linking element)
  • id(Name) the element with an ID attribute of Name
  • html(Name) - the element of type ltAgt with
    attribute NAME of value Name

36
Location Source
  • Relative Location Terms like child() work in
    conjunction with a location source to indicate
    the designated resource
  • An absolute location term is needed
  • The process is iterative - their new location
    provides the location source for the next
    relative instruction

37
Relative location terms
  • Child(2)
  • Keyword
  • child
  • Arguments
  • (2)

38
Relative Keywords
  • child()
  • descendent()
  • ancestor()
  • preceding() - preceding node
  • following() - following node
  • psibling() - preceding sibling
  • fsibling() - following sibling

39
Keywords
  • Each relative keyword identifies a set of
    locations known as candidate locations
  • child() for example identifies all the children
    of the location source
  • More information is needed to which candidate
    locations in the designated resource are being
    addressed

40
Instance Numbers
  • Keyword(Instance Number)
  • positive number
  • negative number
  • all

41
Positive Instance Numbers
Location Source
1
5
2
3
4
6
Children
42
Negative Instance Numbers
Location Source
-6
-2
-5
-4
-3
-1
Children
The candidate locations are counted from last to
first. ancestor(-1) is the root of the element
tree.
43
Selection by Element
  • Keyword(InstanceNumber, ElementName)
  • child(3, DIV1).child(4,DIV2).child(29,P)
  • descendant(-1,EXAMPLE)

44
Selection by Node Type
  • element
  • pi
  • comment
  • text
  • cdata
  • all
  • Only string data terms can follow a selection of
    pi, comment, text and cdata
  • Ancestor, descendant and child are only
    applicable with element selection

45
Selection by Attribute
  • Keyword(InstanceNumber, ElementName, Attribute1,
    Value1)
  • Keyword(InstanceNumber, ElementName, Attribute1,
    Value1, Attribute 2, Value2,..)
  • Attribute can be
  • AttributeName

46
Selection by Attribute
  • Value can be
  • IMPLIED - no value specified and no default
  • - any value even if defaulted
  • Name - case insensitive value Name
  • Name - case sensitive value Name

47
Span Terms
  • Span(XPointer1, XPointer2)
  • This keyword locates a sub-resource starting at
    the beginning of the data selected by the first
    argument and continuing through to the end of the
    data selected by its second argument.
  • Both elements are interpreted relative to the
    location source for the spanning location term
    itself
  • id(a16).span(child(1),child(3))selects the first
    3 children of the element with ID a16

48
Attribute Terms
  • attr(Name)
  • returns the value of the attribute with name Name
    on the element indicated by the location source
    of this term

49
String Data Terms (I)
  • String(InstanceNumber, String)
  • String identifies the candidate strings within
    the location source and InstanceNumber selects
    which occurrence of the string is being addressed
  • Example
  • id(x37).string(3,the) - finds the third
    instance of the in the element with ID x37 and
    select the position just preceding it

50
String Data Terms
  • As with other instance numbers, InstanceNumber
    here can be negative (counting backwards from end
    of location source) or all.
  • String can be null
  • Example id(x37).string(3,)
  • means the position immediately preceding the
    third character

51
String Data Terms (II)
  • string(InstanceNumber, String, Position)
  • Position identifies an offset from the start of
    the candidate string(s) to the beginning of the
    desired final string match. A negative number
    counts left from end.
  • id(x37).string(3,the,2) addresses the position
    immediately preceding the h (the second
    character) in the third occurrence of the in
    the element with ID x37

52
String Data Terms (III)
  • string(InstanceNumber, String, Position, Length)
  • Length specifies the number of characters to
    address. If omitted, zero is assumed which means
    a position between characters is addressed.
  • id(x37).string(3,the,2,1) - addresses the
    letter h in the third occurrence of the element
    with ID x37.
Write a Comment
User Comments (0)
About PowerShow.com