spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / xml_24 / 2 To page 1To page 2To page 3current page
[previous]

Technical Lead
Thomson Reuters (Markets) LLC
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume
Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?


Sams Teach Yourself XML in 24 Hours, Part 2

This code consists of six different links: five for the top five movies and one as a contact link near the bottom of the document. The movie links all link to Amazon.com, whereas the contact link directs you to my web site. The movie links all have their show attributes set to replace, which means the linked resource is opened in the same window as (replaces) the original document. The contact link is slightly different in that its show attribute is set to new (line 45), which means the linked resource is opened in a new window. The actuate attribute for all of the links is set to onRequest (line 46), which requires the user to click the links in order for them to be navigated. Figure 22.5 shows the Top Five movie document as viewed in Firefox.

You may be wondering how the browser knows to underline the links. There isn’t anything magical going on here. I just neglected to show you the CSS stylesheet that is responsible for styling the Top Five document. You can find this stylesheet along with the complete code for this book on my web site, which is located at http://www.michaelmorrison.com/.

Summary

If you think of an XML document as a hierarchical tree of data, which it is, then it’s not too hard to make a comparison between XML documents and the family trees used in genealogy. This comparison is useful because it turns out that one of the best ways to interact with XML data is by thinking in terms of nodes of data that are related to each other as family members. For example, there are parent, child, and sibling nodes at most points in a document’s node tree. XPath is a technology that takes advantage of this hierarchical nature of XML by allowing you to reference parts of XML documents as nodes within a node tree. Although you’ve heard mention of XPath earlier in the book, this hour formally introduced you to it and explored what it has to offer in terms of referencing XML documents.

XPath plays a role in two other emerging XML technologies, XLink and XPointer, which bring advanced linking support to XML, and at some point to the web. You found out about the theoretical underpinnings of XML linking and what it aims to accomplish. You then learned how to create expressions in XPointer, followed by links in XLink. Although you gained some practical knowledge of XLink and XPointer, there unfortunately is very little support for either technology in major web browsers at the moment. Even so, they are compelling enough technologies that you need to keep an eye out for them potentially making an impact in the XML landscape at some point.

Q&A

Q. What is the relationship between XPath and XPointer?

A. XPath is a simple path language that uses patterns and expressions to reference portions of an XML document tree. XPointer extends XPath by offering more specific referencing capabilities within XML documents. XPointer also serves as the basis for identifying link sources and targets in XLink, which is the standard linking technology for XML.

Q. Why bother learning about XLink if it still isn’t supported to any serious degree in major web browsers?

A. The reason for learning about XLink has to do with the fact that it could possibly represent the future of XML document linking. The W3C spent years developing XLink with the goal of it becoming a standard technology with wide support. Admittedly, it’s difficult to get excited about a technology that is somewhat intangible at the moment, but that doesn’t necessarily lessen the future significance of XLink.

Q. Assuming XLink is eventually adopted by web browsers, how will it affect the HTML anchor link?

A. The HTML anchor link (a) is a unique element in HTML that has special meaning to web browsers. In terms of XML, the HTML a element is just another element that happens to be interpreted as a linking element. When browsers add support for XLink, it will be very easy for them to support the a element for backward compatibility, while also supporting new XLink links. Don’t forget that with XLink you can create your own anchor links with very little effort.

Workshop

The Workshop is designed to help you anticipate possible questions, review what you’ve learned, and begin learning how to put your knowledge into practice.

Quiz

Quiz Answers

Exercises

Excerpted from Sams Teach Yourself XML in 24 Hours, Complete Starter Kit, 3rd Edition by Michael Morrison. ISBN 067232797X, Copyright © 2005. Used with the permission of Que & Sams Publishing.

home / programming / xml_24 / 2 To page 1To page 2To page 3current page
[previous]

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business

Created: March 27, 2003
Revised: December 19, 2005

URL: http://webreference.com/programming/xml_24/2