
aad028dbd73c9474fe68974e4bd2f5b0.ppt
- Количество слайдов: 51
XLink & XPointer Sheng. Wu
Contents Covered • XLink – XLink Versus HTML links – Linking Elements – Simple Links – Link Behavior – Extended Links
Contents Covered (Continued) • XPointer – Why use Xpointer – Xpointers in links – Bare Names – Child Squences – Points – Ranges
XLinks Versus HTML Links • What HTML links can do HTML made web possible to embed hypertext links in documents. These links could insert images or let the user to jump from inside one document to another document or another part of the same document.
(Continued) • Limitations of HTML links a. URLs are limited to pointing at a single document. More granularity than that, such as linking to the third sentence of the 17 th paragraph in a document, requires you to manually insert named anchors in the targeted file. It can’t be done without write access to the document to which you are linking.
(continued) b. Furthermore, HTML links don’t maintain any sense of history or relations between documents. Links are purely one way. The linking document knows to whom it’s linking, but not vice versa.
(continued) • What XLink can do ü Xlink is a proposal for more powerful links between documents. ü Xlink achieves everything possible with HTML’s URL-based hyperlinks and anchors. ü Beyond this, it supports multidirectional links where the links run in more than one direction. ü Any element can become a link, not just the a element.
(continued) ü Links do not even have to be stored in the same file as the documents they link. ü Furthermore, Xpointers allow links to point to arbitrary positions in an XML document. These features make XLinks more suitable.
(continued) • Browser Support Netscape and Internet Explorer 5. 5 and earlier have no support for any kind of Xlink. Although a few research projects use Xlinks, there are no general-purpose applications that support arbitrary Xlinks.
Linking Elements • What is a linking element? In HTML, a link is defined with the tag. However, just as XML is more flexible with tags that describe elements, it is more flexible with tags that refer to external resources. In XML, any element can be a link. Elements that include links are called linking elements. Linking elements are identified by an xlink: type attribute.
Linking Element (Continued) • xlink: type attribute values – simple – extended – locator – arc – resource – title
Linking Element (Continued) • Xlink namespace – The xlink prefix must be bound to the http: //www. w 3. org/1999/xlink namespace URI. – The xlink prefix is customary and should be used unless you have got a really good reason to change it.
Linking Element (Continued) • Examples: a.
Linking Elements (Continued) b.
Simple Link • Definition: A simple Xlink is encoded in an XML document as an element of arbitrary type that has an xlink: type attribute with the value simple and an xlink: href attribute. The attribute’s value is the link target’s URI. • How simple link works? A simple link defines a one-way connection between two resources. The source, the connection’s starting resource, is itself the link element. The target or ending resource of the connection is identified by a URI. The URI may be something other than a URL. • Simple links are the only links that are similar to HTML links.
Simple Link (continued) • Example
Link Behavior • Some discussions How is the connection described by XLink presented to the end user or what dose it make software reading the document do? They don’t have just one answer. ü For instance, when the browser encounters a novel element that uses an http URI, clicking the link should probably load the text of the novel from the URL into the current window, thereby replacing the document that contained the link.
Link Behavior (Continued) Then again, maybe it should open a new window and show the user the new document in that window. ü The proper behavior for a browser encountering the novel element that uses an isbn URN is even less clear. Perhaps it should reserve the book with the specified ISBN at the local library. Or perhaps it should order the book from an online bookstore.
Link Behavior (Continued) Page authors can offer suggestions to browsers about how links should be handled by using the xlink: show and xlink: actuate attributes. • Xlink: show – The xlink: show tells the browser or other application what to do when the link is activated. – It has five possible values: ü New: opens a new window and shows the content at the link’s URI (the ending resources) in that window.
Link Behavior (Continued) ü Replace: Shows the ending resource in the current window, replacing the current document ü Embed: Embeds the ending resources in the current document at the location of the link element. ü Other: Do something other than what new, replace, embed do. ü None: Specifies no behavior.
Link Behavior (Continued) • Xlink: actuate – The xlink: actuate attribute tells the browser when to show the content. – The optional xlink: actuate has four possible value ü On. Load: The link should be followed as soon as the application sees it. ü On. Request: The link should be followed when the user asks to follow it. ü Other: Other markup in the document, not specified by xlink, determines when to follow the link. ü None: No details are available.
Link Behavior (Continued) • Example
Link Semantics Xlink elements can have xlink: title and xlink: role attributes to specify the meaning the connection between the resources • Xlink: title this attribute contains a small amount of plain text describing the remote resources. • Xlink: role this attribute contains a URI pointing to a longer description of the remote resource.
Link Semantics (Continued) • Example
Extended Links • Definition: ü An extended link describes a collection of resources and paths between those resources. ü Each path connects exactly tow resources. Any individual resource may be connected to another resource, two other resources, no resources, all other resources, or any subset of other resources in the collection. It may even connect back to itself. ü An extended link is a directed, labeled graph in which the paths are arcs, the documents are vertices, and the labels are URIs.
Extended Links (Continued) • Simple links are easy to understand by analogy to HTML links. However, no obvious analogy exists for extended links. What the links look like, how applications treat them, and what user interfaces present them to people is all undecided.
Extended Links (Continued) • Extended elements: in XML, an extended link is represented by an extended link element, an element of arbitrary type that has an xlink: type attribute with the value extended.
Extended Links (Continued) Most extended links contain local resources, remote resource, and arcs between those resources. ü A remote resource is represented by a locator element, which is any type of element that has an xlink: type attribute with the value locator. ü A local resource is represented by a resource element, any type of element that has an xlink: type attribute with resource. ü An arc element, any type of element that has an xlink: type attribute with the value arc, represents a connection between two resources.
Extended Links (Continued) • Locator element – Each locator element has an xlink: type attribute with the value locator and an xlink: href attribute containing a URI for the resource it locates. – Usually each locator element also has an xlink: label attribute that serves as the element’s ID.
Extended Links (Continued) • Example of locator element
Extended Links (Continued) • Arc element – Paths between resources are called arcs. Arcs are represented by arc element. – Each arc element should have an xlink: from and an xlink: to attribute. Xlink: from identifies the link’s source and xlink: to identifies the link’s target. – Both xlink: from and xlink: to do not contain URIs, they contain a name matching the value of the xlink: label attribute of one of the locator elements in the extended links.
Extended links (Continued) • Example (Mutiple arcs from one arc element)
Extended Links (Continued)
Extended Links (Continued)