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

📄 0158-0161.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="0154-0157.html">Previous</A> | <A HREF="../ewtoc.html">Table of Contents</A> | <A HREF="0162-0164.html">Next</A></CENTER></P><A NAME="PAGENUM-158"><P>Page 158</P></A><P>The abstract nature of these definitions reflects the fact that XML links canbe used for any sort of connection between information resources. To give youa more concrete idea of how the SHOW attribute works, let's review thebehavior of a typical HTML browser.</P><P>&lt;A&gt; hyperlinks cause the current screen to be cleared and replaced by theone you have just linked to. (This is what REPLACE does.) Conversely, if the linkis to an ftp download, that operation is carried out in a separate window.(This is what NEW does.)</P><P>There isn't really an equivalent for EMBED in HTML. Its action is similarto pasting a picture into your Web page using theIMG tag, except that what you are pasting is all or part of another page.</P><P>The second aspect of link behavior that you can control is timing&#151;whenthe link should be traversed. The ACTUATE attribute has two possible values:</P><UL><LI>     AUTO: The link is to be traversed as soon as it is found. Readingthe link and fetching its target resource are considered part of theprocess of reading the current resource.<LI>     USER: It is up to the user to ask for the link to be traversed;otherwise, it doesn't happen.</UL><P>Using these terms in combination, as in</P><!--  CODE SNIP //--><PRE>&lt;MYLINK HREF=&quot;X&quot; SHOW=&quot;EMBED&quot; ACTUATE=&quot;USER&quot; ...&gt;</PRE><!--  END CODE SNIP //--><P>has the same meaning as the following HTML coding:</P><!--  CODE SNIP //--><PRE>&lt;IMG SRC=&quot;X&quot;&gt;</PRE><!--  END CODE SNIP //--><P>The meaning is the same because it causes the application to treat thelinked resource as though it is part of the current document (even though it isn't).</P><P>Similarly, the combination</P><!--  CODE SNIP //--><PRE>&lt;MYLINK HREF=&quot;X&quot; SHOW=&quot;REPLACE&quot; ACTUATE=&quot;AUTO&quot; ...&gt;</PRE><!--  END CODE SNIP //--><P>has the same effect as the following HTML coding:</P><!--  CODE SNIP //--><PRE>&lt;A HREF=&quot;X&quot;&gt;</PRE><!--  END CODE SNIP //--><P>The effect is the same because it causes the current screen to be replaced bythe linked resource, but only when the user asks for it to be replaced.</P><P>Finally, if the SHOW and ACTUATE attributes don't control the behavior ofthe link sufficiently closely, you can use theBEHAVIOR attribute to provide your own detailed instructions.</P><A NAME="PAGENUM-159"><P>Page 159</P></A><TABLE BGCOLOR="#FFFF99"><TR><TD>Note:</TD></TR><TR><TD><BLOCKQUOTE>XML doesn't specify how to use BEHAVIOR; it just recommendsthat XML processors should look there for detailed guidance on how thelink should behave. This probably means thatBEHAVIOR will be used in a variety of ways, which are specific to particular XML applications.</BLOCKQUOTE></TD></TR></TABLE><H4><A NAME="ch09_ 14">Link Roles</A></H4><P>Every XML link can have a role. This appears in the link'sROLE attribute, and it states the meaning of the link. Each resource that participates in a linkalso can have its own role.</P><P>To put this a bit more generally, links are usually included to expressrelationships between the things they connect. Some links connect to subsectionsof the current document, others add support or background, and others havea very different meaning such as providing access to metadata (author, dateof publication, and so on) about the current document.</P><TABLE BGCOLOR="#FFFF99"><TR><TD>Note:</TD></TR><TR><TD><BLOCKQUOTE>The ROLE attribute is designed to be used by an applicationprogram and, therefore, is an aid to the machine. TheTITLE attribute, described next, is provided for human consumption.</BLOCKQUOTE></TD></TR></TABLE><P>In an XML application for thesauri, for example, links might be used toconnect a mini-document for a single term to other mini-documentsdescribing the following items:</P><UL><LI>     Its broader term<LI>     Each of its narrower terms<LI>    &quot;See also&quot; terms</UL><P>Each of these types of links should have its own specific role.</P><P>The XML standard doesn't predefine any &quot;approved&quot; values for link roles.The roles assigned, and their semantics, will be specific to the particular XMLapplication within which they are used.</P><P>Knowing what type of link you are dealing with is a tremendousadvantage. For a start, it allows better control over display. In the thesaurus example,links to broad terms and to narrower terms should look different.</P><A NAME="PAGENUM-160"><P>Page 160</P></A><TABLE BGCOLOR="#FFFF99"><TR><TD>Note:</TD></TR><TR><TD><BLOCKQUOTE>To maintain fine control over how an application's links aredisplayed, you might require a custom XML browser that &quot;knows about&quot; thatparticular application and interprets its link roles correctly. Alternatively, it shouldbe possible to simply write an XS style sheet for the application because thelink role information is part of the document, so it can be tested within thestyle sheet. Then you can use a generic XML browser to view theapplication's documents.</BLOCKQUOTE></TD></TR></TABLE><P>Link roles also offer a whole new dimension for searching. If you caninclude a search on the link role as part of a query, it becomes possible to searchfor pages that have a particular relationship, and to find information that isspread among two or more documents linked in a particular way.</P><TABLE BGCOLOR="#FFFF99"><TR><TD>Note:</TD></TR><TR><TD><BLOCKQUOTE>When an out-of-line link involves two or more locators, each canbe given its own ROLE. This allows asymmetrical relationships (such asparent-child links) to be expressed clearly.</BLOCKQUOTE></TD></TR></TABLE><H4><A NAME="ch09_ 15">Labels for Links</A></H4><P>Every locator can have a TITLE attribute, which acts as a label:</P><!--  CODE SNIP //--><PRE>&lt;A TITLE=&quot;W3 Consortium Home Page&quot; HREF=&quot;http://www.w3.org/</A><BR>&quot;&gt;The W3C&lt;/A&gt;</PRE><!--  END CODE SNIP //--><P>XML applications decide whether to use this label and what to use itfor. However, TITLE follows the same concept as in HTML, so it probably willbe used in a similar way. In general, TITLE is expected to provide a human-<BR>readable description of the link, which could be used as a pop-up hintwithin an XML browser. This contrasts with ROLE, which is intended for machineconsumption.</P><TABLE BGCOLOR="#FFFF99"><TR><TD>Warning:</TD></TR><TR><TD><BLOCKQUOTE>The current draft notes that, &quot;The simple labelingmechanism described in this draft is insufficiently flexible to cope withinternationalization or the use of multimedia in link labels. A future version will provide amechanism for the use of structured link titles.&quot;</BLOCKQUOTE></TD></TR></TABLE><A NAME="PAGENUM-161"><P>Page 161</P></A><H3><A NAME="ch09_ 16">Simple Links</A></H3><P>Most of the XML links you add probably will beSIMPLE links, so I'll start with them and then move on to extended links.</P><P>XML's simple links are very much like HTML&lt;A&gt; elements. However, you can achieve a greater variety of effects with XML simple links bycontrolling their behavior and assigning roles to them, as I discussed in the previoussection.</P><P>An XML simple link points to a single resource. This is specified as thevalue of its mandatory HREF attribute:</P><!--  CODE SNIP //--><PRE>&lt;LINK HREF=&quot;http://www.w3.org/&quot;&gt;The</A> W3C&lt;/LINK&gt;</PRE><!--  END CODE SNIP //--><P>In addition to the HREF attribute, simple links can have any of theadditional features covered in the last section.</P><P>Here is an example of a thesaurus application of XML:</P><!--  CODE SNIP //--><PRE>&lt;broad-term ROLE=&quot;BT&quot; SHOW=&quot;EMBED&quot; HREF=&quot;mats.xml&quot;&gt;materials&lt;/broad-term&gt;</PRE><!--  END CODE SNIP //--><P>This application associates a specific role&quot;BT&quot; and a SHOW behavior of&quot;EMBED&quot; with a broad-term linking element.</P><P>The &quot;BT&quot; role allows an XML thesaurus application to display the link ina different way from a link to a narrower term. TheSHOW behavior indicates that the details of the broader term should be embedded in the current screenif the user clicks on the link.</P><P>In practice, this additional information is often incorporated into theDTD by using #FIXED attribute values. This removes the need to specify it foreach linking element in your XML documents. For example, the attribute listdeclaration for the broad-term element type might look like this:</P><!--  CODE //--><PRE>&lt;!ATTLIST broad-term    XML-LINK CDATA #FIXED &quot;SIMPLE&quot;    ROLE CDATA #FIXED &quot;BT&quot;    HREF CDATA #REQUIRED    TITLE CDATA #IMPLIED    SHOW (EMBED|REPLACE|NEW) &quot;EMBED&quot;    ACTUATE (AUTO|USER) &quot;USER&quot; &gt;</PRE><!--  END CODE //--><P><CENTER><A HREF="0154-0157.html">Previous</A> | <A HREF="../ewtoc.html">Table of Contents</A> | <A HREF="0162-0164.html">Next</A></CENTER></P></TD></TR></TABLE></BODY></HTML>

⌨️ 快捷键说明

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