Title: XML Part 5: XLL: The Extensible Linking Language
1XML Part 5 XLL The Extensible Linking Language
- World Wide Web Technology
2XLL 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
3XLink
- 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
4Links 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
5Link 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
6Link 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
7Example
- 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
8Locators
- 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
9Connectors
- 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
10Whole document addressed using URI
Doc ltgtfragment resourceltgt
Subresource addressed using XPointer
11Connectors
- 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
12Queries
- 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
13Types 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
14Types of Linking Element
- Simple link
- usually inline and always one-directional
- Extended link
- more general
15Example
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
16Other 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
17Link 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
18Simple 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
19Simple Link
- ltASimpleLink hrefhttp//www.somesite.com/diction
ary/ shownew content-roleterm
roledefinitiongtXMLlt/ASimpleLinkgt - Simple links can be out-of-line
20Extended 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
21Extended 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.
22Extended 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
23Attribute 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.
24Attribute 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
25Attribute Remapping
- ltperson rolePresenter LinkRoleHomePagehref
http//www.somesite.com/jlygt JJYlt/persongt
26XPointer
- 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
27Locators
- 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
28Fragments 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
29Extended 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
30Documents as trees
MEMO
TO
FROM
MESSAGE
31Documents as trees
Root
MEMO
Parent
Child
TO
FROM
MESSAGE
Sibling
32Location Terms
- Absolute terms
- Relative terms
- Span terms
- Attribute Terms
- String Data Terms
33Xpointer Structure
MEMO
Root()
Child(1)
TO
FROM
MESSAGE
root().child(1)
34Xpointer 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
35Absolute 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
36Location 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
37Relative location terms
- Child(2)
- Keyword
- child
- Arguments
- (2)
38Relative Keywords
- child()
- descendent()
- ancestor()
- preceding() - preceding node
- following() - following node
- psibling() - preceding sibling
- fsibling() - following sibling
39Keywords
- 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
40Instance Numbers
- Keyword(Instance Number)
- positive number
- negative number
- all
41Positive Instance Numbers
Location Source
1
5
2
3
4
6
Children
42Negative 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.
43Selection by Element
- Keyword(InstanceNumber, ElementName)
- child(3, DIV1).child(4,DIV2).child(29,P)
- descendant(-1,EXAMPLE)
44Selection 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
45Selection by Attribute
- Keyword(InstanceNumber, ElementName, Attribute1,
Value1) - Keyword(InstanceNumber, ElementName, Attribute1,
Value1, Attribute 2, Value2,..) - Attribute can be
-
- AttributeName
46Selection 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
47Span 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
48Attribute Terms
- attr(Name)
- returns the value of the attribute with name Name
on the element indicated by the location source
of this term
49String 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
50String 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
51String 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
52String 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.