SNUOOPSLA Lab.
Hypertext links(XLL)
© copyright 2001 SNU OOPSLA Lab.
SNU
OOPSLA Lab.
Contents
• Concepts• XML syntax basic links• XML linking specification• URLs• Link behavior• Extended pointers• Attribute name conflicts• Link value strategies
SNU
OOPSLA Lab.
Basic Link
• Source– a phrase that directs the reader’s attention
to other information• Target
– is located at the start of the required text
SNU
OOPSLA Lab.
Terminology
• Resource– target object
• Linking element– source
• Traversal– the act of moving from the liking element to
the resource
SNU
OOPSLA Lab.
Terminology(Cont’d)
• Simple link– the primitive one-directional linking
scheme, but make it possible to traverse links between documents
SNU
OOPSLA Lab.
URLs
• Objects are identified using the URL mechanismSee <link target=“MyServe.MyCorp.com/xml/Doc9#X123”>
Details</link>
…
</chapter>
<chapter ident=“X123”>
<title> Details </title>
<p> The details are …
</chapter>
...
SNU
OOPSLA Lab.
Attributes in the Linking Element
• Attributes in the linking element can influence– the means by which a link can be activated
• a link could be activated by the person(‘user’ link)• directly by the application(‘auto’ link)
– the presentation technique required once it has been activated
• application may jump to the specified resource(‘replace’)
• display the resource in another window(‘new’)• insert the resource into the original text(‘embed’)
SNU
OOPSLA Lab.
Extended Link
• Extended link– resources can be cross-related– an extended link contains a number of
locator elements, each one points to a resource
SNU
OOPSLA Lab.
Out-of-line Link
• Out-of-line link– provides facility of separating the extended
link from all the resources it defines– may physically appear in-line, in the sense
that it is placed in the flow of text– a more obvious place to put out-of-line
links is at the top of the document
SNU
OOPSLA Lab.
Extended Link Group
• Extended link group– a number of extended document pointers
are used to identify all the inter-linked documents
– they are contained in an extended group element
=> all the documents concerned are deemed to be pointers to each other
SNU
OOPSLA Lab.
XML syntax basic links
<!ELEMENT section (…)>
<!ATTLIST section target ID #REQUIRED>
<section target=“s”>
<title>This is Section 6</title>
…
</section>
<!ELEMENT xref (…) >
<!ATTLIST xref link IDREF #REQUIRED>
<para>Please refer to
<xref link=“s6”>Section 6</xref>
for more details</para>
SNU
OOPSLA Lab.
Identifying links
• Assumes– advanced linking features described here are not
inherent in the XML syntax– so are not based on reserved attribute types– an XML parser is therefore unable to validate the links– there is another layer of software, an ‘XML link
processor’• interrogates the parsed document instance, and
possibly also the DTD to detect and activate linking feature
SNU
OOPSLA Lab.
Identifying links(Cont’d)
• If no DTD, the reserved attributes may be stored in the document
<link xml-link=“simple” href=“…”>the link</link>
• When a DTD is used, this information is stored in the attribute declaration
<!ATTLIST link xml-link CDATA #FIXED “simple”
href CDATA #REQUIRED>
<link href=“…” >the link</link>
SNU
OOPSLA Lab.
Simple Links
• Simple link – contains only one resource locator– only the Href and xml-link attributes are required– any name can be chosen for the linking element
See <simple href=“…”>book 9</simple> for details
<!ATTLIST simple xml-link CDATA #FIXED “simple”>
<simple href=“http://ProcMan.xml#Sec9” xml-link=“simple”>
See Section 9 of the Procedures Manual
</simple>
SNU
OOPSLA Lab.
Title and Role• Title
– it is useful for simple links to be labeled, so that the user can decide whether it would be profitable to follow the link
<!ATTLIST link …title CDATA #IMPLIED>
… are you going to<link href=“#X123” title=“Location”>Scarborough</link> fair?
• Role– is used to create categories of link that can be accessed by specialized
browsers<!ATTLIST link …
role CDATA #IMPLIED>… are you going to
<link href=“#X123” role=“describe”>Scarborough</link> fair?
SNU
OOPSLA Lab.
Extended Links
• Extended links– refer to a number of resources by including embedded
resource locators– each locator is stored in a locator element– all related locator elements are grouped within an extended
element– the DTD author must ensure that the extended element can
contain the locator element, as well as any DTD specific elements appropriate at this point
SNU
OOPSLA Lab.
Extended Links(Cont’d)
<!ELEMENT para (#PCDATA | extend | emph)>
<!ELEMENT extend (#PCDATA | locate | emph)>
<!ATTLIST extend xml-link=“extended” … >
<!ELEMENT locate (#PCDATA)>
<!ATTLIST locate xml-link=“locator” …>
<para>Here are
<extend>some <emph>extended</emph>
links:
<locate href=“…”>Locator 1</locator>,
<locate href=“…”>Locator 2</locator>
</extend>
</para>
Here are some extended links: Locator1, Locator2.
SNU
OOPSLA Lab.
Content Role and Content Title
• Content role and content title– locators in extended links are labeled with
the title attribute– extended link itself, if it is an in-line link,
should also have a title and role
SNU
OOPSLA Lab.
Content Role and Content Title(Cont’d)
<!ATTLIST extend …
content-role CDATA #IMPLIED
content-title CDATA #IMPLIED>
<song>
<title>Are you going to
<extend content-title=“song” content-role=“reference”>
Scarborough
<locator title=“location” role=“explain” href=“…”/>
<locator title=“history” role=“explain” href=“…”/>
</extend>
fair?</title>
…
</song>
SNU
OOPSLA Lab.
Out-of-link Links
• In-line links– a link that serves as one of its own resources– a link source that is embedded within the text
• Out-of-line links– a link that does not serve as one of its own
resources– should be considered when
• a read-only document is involved• different links are required for different groups of
people, where seeing other’s links is confusing
SNU
OOPSLA Lab.
Out-of-link Links(Cont’d)
• The Inline attribute must be set to ‘false’ to identify an out-of-line link
<extend inline=“false”>
<locator href=“…”>Locator 1</locator>
<locator href=“…”>Locator 2</locator>
</extend>
SNU
OOPSLA Lab.
Extended Link Groups
• Group element– other documents in a group of inter-linked
documents can be identified with steps attribute• contains a value stating how many steps to take
– which contains document element with href attribute
<group steps=“2”>
<document href=“DocumentHub”>Document Hub</document>
</group>
SNU
OOPSLA Lab.
URLs
• The method for locating entire documents
<link href=“/xml/myfiles/detail.xml”>See details</link>• Linking a specific element in the current file
<link href=“../myfiles/detail.xml#part3”>See details, part 3</link>
– entire document is delivered• Indicating that only referenced part of the document is
required
<link href=“../myfiles/detail.xml|part3”>See details, part 3</link>
SNU
OOPSLA Lab.
Link Behavior
• Actuate– user: the links only traversed when explicitly selected by the user– auto: the link is activated automatically as soon as the linking
element is presented to the user• Show
– replace: the browser replaces the source text with the resource required
– embed: the resource is brought to and embedded in the source text
– new: the browser opens a new window to display the resource, leaving the original window on-screen
SNU
OOPSLA Lab.
Link Behavior(Cont’d)
• The show and actuate attributes also appearing in the extended links
<extend show=“new”>
<locate href=“…” />
<locate href=“…” show=“embed” />
</extend>
SNU
OOPSLA Lab.
Extended Pointers
• XPointer– a mechanism for identifying a designated
resource by its location
• Instructions(location terms) in an XPointer– refer to the element hierarchy tree– include references to siblings, children and
ancestors– are read from left to right
SNU
OOPSLA Lab.
Extended Pointers(Cont’d)
• Exampleshttp://MyServe.MyCorp.com/
xml/doc9#ROOT()CHILD(3,chap)STRING(7,”Napoleon”,0)
http:// MyServe.MyCorp.com/
xml/doc9?
XML-XPTR=ROOT()CHILD(3,chap)STRING(7,”Napoleon”,0)
SNU
OOPSLA Lab.
Absolute Locations
• HERE()– identifies the current element(the linking element itself)
• ID()– specifies an element containing an attribute of type ID
ID(sec17)
<section target=“sec17”>…</section>’• HTML()
– specifies the name of an Anchor element in an HTML document
HTML(para3)
<p><a name=“para3”>The third paragraph.</a>…</p>
SNU
OOPSLA Lab.
Absolute Locations(Cont’d)
• ROOT()– identifies the entire document as the container of
the target resource
• DITTO()– specifies the result of the first search as the
starting-point for this second search
SNU
OOPSLA Lab.
Relative Locations
• CHILD()– specifies a child of the current element
CHILD(3, .)
<para>…</para> <1
<list>…</list> <2
<para>…</para> <3
CHILD(3, *)
<number>13</number> <1
High Str., <2
<town>NewTown</town> <3
SNU
OOPSLA Lab.
Relative Locations(Cont’d)
CHILD(1, *CDATA)
<number>13</number>
High Str., <1
<town>NewTown</town>
CHILD(3, para)
<para>…</para> <1
<list>…</list>
<para>…</para> <2
<table>…</table>
<para>…</para> <3
SNU
OOPSLA Lab.
Relative Locations(Cont’d)CHILD(3, para, status, secret)
<para status=“secret”>…</para> <1
<para status=“SECRET”>…</para> <2
<para status=“normal”>…</para>
<para status=“normal”>…</para>
<para status=“Secret”>…</para> <3
CHILD(2, para, author, “D. Adams”)
<para author=“D.Adams”>…</para>
<para author=“Dikens”>…</para>
<para author=“D. Adams”>…</para> <1
<para author=“d. adams”>…</para>
<para author=“D. Adams”>…</para> <2
SNU
OOPSLA Lab.
Relative Locations(Cont’d)
CHILD(3, para, status, *IMPLIED)
<para status=“secret”>…</para>
<para>…</para> <1
<para>…</para> <2
<para status=“normal”>…</para>
<para>…</para> <3
CHILD(3, PARA, STATUS, *)
<para status=“secret”>…</para> <1
<para>…</para>
<para status=“normal”>…</para> <2
<para status=“normal”>…</para> <3
<para>…</para>
SNU
OOPSLA Lab.
Relative Locations(Cont’d)
• ANCESTOR()– specifies a search through enclosing elements
• FSIBLING()– identifies a following sibling– to select next element:
<para>…</para><para>…</para> <1
– to select the penultimate element:
<chapter><para>…</para><para>…</para><para>…</para> < -2<para>…</para> < -1</chapter>
SNU
OOPSLA Lab.
Relative Locations(Cont’d)
• PSIBLING()– identifies a previous sibling to the current element– to select the previous element
<para>…</para> <1<para>…</para>
– to select the second element in the enclosing element <chapter><para>…</para> < -1<para>…</para> < -2<para>…</para><para>…</para></chapter>
SNU
OOPSLA Lab.
Relative Locations(Cont’d)
• DESCENDANT()– indicates an element anywhere within the location
source• FOLLOWING()
– has a similar effect as DESCENDANT, except that it not bounded by the current element’s end-tag, but searches on to the end of the document
• PRECEDING()– initiates a search back through the document,
ignoring document hierarchies
SNU
OOPSLA Lab.
Relative Locations(Cont’d)
• STRING()– locates a given letter, word, phrase or other string
of text, such as ‘Napoleon the Emperor’– the first parameter is an occurrence counter– the second parameter is the string to find
STRING(1, ‘Napoleon the Emperor’, 0)
Using the N element for name and Occ for
occupation, “Napoleon the Emperor” is coded… <1
SNU
OOPSLA Lab.
Relative Locations(Cont’d)
• STRING()– tags are transparent to the search:
STRING(1, ‘Napoleon the Emperor’, 0)
Using the N element for name and Occ for
occupation, “Napoleon the Emperor” is coded… <1
<n>Napoleon</n> the <occ> Emperor</occ> <2– the third parameter is a value specifying an offset from the start of the search
text
STRING(1, ‘Napoleon the Emperor’, 7)
Using the N element for name and Occ for
occupation, “Napoleon the Emperor” is coded… <1
<n>Napoleon</n> the <occ> Emperor</occ> <2
SNU
OOPSLA Lab.
Attribute Name Conflicts
• xml-attribute attribute can be used to rename the others
<!ATTLIST link
xml-attributes CDATA “show xshow”
xshow (embed|replace|new) “replace”>
<!ATTLIST link
xml-attributes CDATA “show xshow title xtitle”
xshow (embed|replace|new) “replace”
xtitle CDATA #IMPLIED>
<!ATTLIST link xml-attributes “href target”
target CDATA #REQUIRED>
<link target=“X123”>…</link>
SNU
OOPSLA Lab.
Link Value Strategies
• Document authors are usually required to generate identifiers for new objects– simply assign the next available sequential value– assigning the title, or an abbreviation of the title, to
a locator:
<xref idref=“#Summary”>– an abbreviated reference scheme may be
considered
see <xref idref=“#ch7pa12”>Chapter 7, Paragraph 12</xref>