⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0151-0153.html

📁 Presenting XML.rar,详细介绍有关XML的知识
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "html.dtd"><HTML><HEAD><TITLE>Presenting XML:Linking with XML:EarthWeb Inc.-</TITLE><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><SCRIPT><!--function displayWindow(url, width, height) {        var Win = window.open(url,"displayWindow",'width=' + width +',height=' + height + ',resizable=1,scrollbars=yes');}//--></SCRIPT></HEAD><BODY  BGCOLOR="#FFFFFF" VLINK="#DD0000" TEXT="#000000" LINK="#DD0000" ALINK="#FF0000"><TD WIDTH="540" VALIGN="TOP"><!--  <CENTER><TABLE><TR><TD><FORM METHOD="GET" ACTION="http://search.itknowledge.com/excite/cgi-bin/AT-foldocsearch.cgi"><INPUT NAME="search" SIZE="20" VALUE=""><BR><CENTER><INPUT NAME="searchButton" TYPE="submit" VALUE="Glossary Search"></CENTER><INPUT NAME="source" TYPE="hidden" VALUE="local" CHECKED> <INPUT NAME="bltext" TYPE="hidden" VALUE="Back to Search"><INPUT NAME="sp" TYPE="hidden" VALUE="sp"></FORM></TD><TD><IMG SRC="http://www.itknowledge.com/images/dotclear.gif" WIDTH="15"   HEIGHT="1"></TD><TD><FORM METHOD="POST" ACTION="http://search.itknowledge.com/excite/cgi-bin/AT-subscriptionsearch.cgi"><INPUT NAME="search" SIZE="20" VALUE=""><BR><CENTER><INPUT NAME="searchButton" TYPE="submit" VALUE="  Book Search  "></CENTER><INPUT NAME="source" TYPE="hidden" VALUE="local" CHECKED> <INPUT NAME="backlink" TYPE="hidden" VALUE="http://search.itknowledge.com:80/excite/AT-subscriptionquery.html"><INPUT NAME="bltext" TYPE="hidden" VALUE="Back to Search"><INPUT NAME="sp" TYPE="hidden" VALUE="sp"></FORM></TD></TR></TABLE></CENTER> --><!--  ISBN=1575213346 //--><!--  TITLE=Presenting XML//--><!--  AUTHOR=Richard Light//--><!--  PUBLISHER=Macmillan Computer Publishing//--><!--  IMPRINT=Sams//--><!--  CHAPTER=09 //--><!--  PAGES=0147-0178 //--><!--  UNASSIGNED1 //--><!--  UNASSIGNED2 //--><P><CENTER><A HREF="0147-0150.html">Previous</A> | <A HREF="../ewtoc.html">Table of Contents</A> | <A HREF="0154-0157.html">Next</A></CENTER></P><A NAME="PAGENUM-151"><P>Page 151</P></A><P>This compatibility means that XML links have the same look and feel asHTML links. The following links can be as valid within an XML document asthey would be within an HTML page:</P><!--  CODE //--><PRE>&lt;A HREF=&quot;http://www.anothersite.org/pub/doc3.xml&quot;&gt;</A>&lt;A HREF=&quot;http://www.anothersite.org/pub/doc3.xml#section2&quot;&gt;</A>&lt;A HREF=&quot;http://www.anothersite.org/pub/doc4.html&quot;&gt;</A></PRE><!--  END CODE //--><P>Because URLs have the same form in both HTML and XML documents,there is equally no problem in including a link to an XML document withinan HTML page. The only difference between a link to an XML document anda link to another HTML page is that any fragment identifier or query thatfollows the URL is interpreted in an XML-specific manner when the target isan XML document:</P><!--  CODE SNIP //--><PRE>&lt;A HREF=&quot;http://www.anothersite.org/pub/doc3.xml#chap.2&quot;&gt;</A></PRE><!--  END CODE SNIP //--><P>Here, the fragment identifier chap.2 specifies an element within theXML document doc3.xml, with an ID attribute value equal tochap.2.</P><P>So XML links fulfill the interoperability requirement very neatly.</P><H4><A NAME="ch09_ 5">Additional Linking Facilities</A></H4><P>However, if XML-Link were content to simply mimic HTML's links,it wouldn't add any new functionality. Also, one principle of generalizedmarkup is that users must be free to define tagsets that are meaningful to theirown application. This means that XML cannot insist (as HTML does) that alimited number of element types be reserved for links.</P><P>The XML-Link specification extends HREF links in the following ways:</P><UL><LI>     Allowing any element type to indicate the existence of a link<LI>     Defining the precise meaning of thefragment identifier (the part of the URL that follows the# or |) in cases when the target of the link is an XML document<LI> Providing links with human-readable labels<LI>    Providing links with machine-readable labels<LI>   Specifying policies for the context in which links are displayedand processed<LI>     Specifying policies for when links are traversed<LI>     Supporting extended linking groups<LI>     Supporting multi-ended links</UL><A NAME="PAGENUM-152"><P>Page 152</P></A><H3><A NAME="ch09_ 6">Some Linking Concepts</A></H3><P>The XML-Link specification talks about some rather specializedconcepts, which are best defined before you get into the details.</P><UL><LI>Resource: This is any addressable object that is taking part in alink. Examples include documents, parts of (and points within)documents, images, programs, and query results.<LI>     Linkingelement: This is a special element within an XMLdocument that asserts the existence of a link and contains a description ofthe link's characteristics.<LI>Locator: A character string appearing in a linking element that isthe address of a resource and can be used to locate that resource.<LI>    Title:This is a caption associated with a resource, suitable forexplaining to human users the significance of the part played in the linkby that resource.<LI>Traversal: This is the action of using a link to access aresource. Traversal can be initiated by a user action (for example, clicking ona displayed portion of a linking element), or it can occur underprogram control.<LI>     Multidirectionallink: This link can be traversed starting at morethan one of its resources. Note that being able to go back after followinga one-directional link does not make the link multidirectional.<LI>     Inlinelink: This link is indicated by a linking element that servesas one of its own resources. HTML &lt;A&gt; elements are examples ofinline links.<LI>    Out-of-linelink: This link is indicated by a linking element thatdoes not serve as one of its own resources (except perhaps by chance).It need not even occur in the same document as any of the resourcesit serves to connect.</UL><H4><A NAME="ch09_ 7">A Concrete Example</A></H4><P>These definitions rightly suggest that I want you to think about links in amore abstract way than usual. To give the discussion a more concrete basis, let'stry to describe a standard HTML &lt;a&gt; link using this terminology.</P><A NAME="PAGENUM-153"><P>Page 153</P></A><P>Here's the concrete example. The link</P><!--  CODE //--><PRE>&lt;a NAME=&quot;link14&quot;HREF=&quot;http://www.othersite.org/pub/doc4.html#chap4&quot;&gt;</A></PRE><!--  END CODE //--><P>points to an &lt;a&gt; element in the documentdoc4.html:</P><!--  CODE SNIP //--><PRE>&lt;a NAME=&quot;chap4&quot;&gt;The target&lt;/a&gt;</PRE><!--  END CODE SNIP //--><P>Let's start with the target of the link. This is aresource, which is an addressable unit of information participating in a link. The&lt;a&gt; element is an addressable unit because it has been given aNAME attribute value, which is how HTML specifies link targets within documents.</P><TABLE BGCOLOR="#FFFF99"><TR><TD>Note:</TD></TR><TR><TD><BLOCKQUOTE>When using HTML, you tend to think of within-document linktargets as just the point at which you start reading, but the XML concept of aresource has more substance. If the target of this link were within an XMLdocument instead of an HTML one, the resource you are pointing to would be thewhole &lt;a&gt; element, including the text Thetarget that appears before its &lt;a/&gt; end-tag. As you will see, resources in XML can be very meaty chunks of information!</BLOCKQUOTE></TD></TR></TABLE><P>Next, consider the &lt;a&gt; element itself. This is quite clearly alinking element, because its HREF attribute value asserts the existence of a link.</P><P>The link's HREF attribute valuehttp://www.othersite.org/pub/doc4.html#chap4</A> is an example of alocator.</P><P>This link is traversed when you click on the link and move to the target page.</P><P>The &lt;a&gt; element also is an inline link. The definition says that it serves asone of its own resources. What does that mean? All links must have at leasttwo ends, so think of a link as a piece of string connecting two things. You canpin the far end of the piece of string onto the target of the link (the URLspecified in the HREF attribute value), but where do you pin the near end? On this&lt;a&gt; element, of course!</P><P>Another point is that &lt;a&gt; (anchor) elements can also act as a resource iftheir NAME attribute is specified. For example, the following is a link whosetarget resource (the far end of the piece of string) is the example&lt;a&gt; link element:</P><!--  CODE SNIP //--><PRE>&lt;a HREF=&quot;#link14&quot;&gt;Here's a link&lt;/a&gt;</PRE><!--  END CODE SNIP //--><P><CENTER><A HREF="0147-0150.html">Previous</A> | <A HREF="../ewtoc.html">Table of Contents</A> | <A HREF="0154-0157.html">Next</A></CENTER></P></TD></TR></TABLE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -