`
semi_sleep
  • 浏览: 99075 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

读XML in a Nutshell (7)

    博客分类:
  • XML
XML 
阅读更多

本篇包括Charpter 10 XLink。
XLink相比html的anchor来说要抽象许多了,而它能表示的内容也广泛很多,从某种角度来说xlink定义的是graph而不仅仅是link这么简单,通过locator跟resource定义点,通过arc定义边,从而构成任意的图。
要点如下:

1.XLink的namespace是http://www.w3.org/1999/xlink。XLink主要分为两种类型,simple跟extended。

2.Simple的xlink定义如下,可以使用xlink:show(可选值为new,replace,embed,other,none)跟xlink:actuate(可选值为onLoad,onRequest,other,none)这两个attribute来控制其行为,可以通过xlink:title跟xlink:role来描述其语义,其中title是一段文字,role是某个url。
<novel xlink:type = "simple" xlink:href = "ftp://archive.org/pub/etext/etext93/wizoz10.txt"/>

3.Extended的xlink通过定义点和边来描述一个图,所有的点和边的定义必须包含在含有xlink:type="extended"的element中,本地资源采用xlink:type="resource"定义,非本地资源采用xlink:type="locator"定义,边采用xlink:type="arc"定义。Resource跟locator都可以使用xlink:title跟xlink:role来描述其语义,同时使用xlink:label来为其命名,使其可以被arc引用。Arc用xlink:title跟xlink:arcrole来描述其语义,同时使用xlink:from跟xlink:to来描述其起始及终结的点,其中由于不同的resource或者locator可能有同个label,这个时候arc描述的是若干条边,而通过省略xlink:from或xlink:to可以选择所有的点,最后需要注意的是在同个extended的xlink下面,不同的arc所描述的边不能由重复(交集),否则视为错误。例子如下:
<author xlink:type="resource">L. Frank Baum</author>
<edition xlink:type="locator" xlink:href="urn:isbn:0688069444" xlink:title="William Morrow" xlink:role="http://www.williammorrow.com/" xlink:label="ISBN0688069444"/>
<purchase xlink:type="arc" xlink:from="ISBN0192839306" xlink:to="buy" xlink:arcrole="http://www.example.com/purchase_details.txt" />

4.在非本地资源间的边称为third-party links,从本地资源到非本地资源的边成为outbound links,从非本地资源到本地资源的边成为inbound links,如果一个xml document含有third-party links或者inbound links称为linkbase。

5.书中列举了两个在dtd中加入xlink支持的例子,如下:
<!ELEMENT novel (title, author, year)>
<!ATTLIST novel xmlns:xlink CDATA #FIXED 'http://www.w3.org/1999/xlink' xlink:type (simple) #FIXED 'simple' xlink:href CDATA #REQUIRED>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT year (#PCDATA)>

<!ENTITY % simplelink "xlink:type (simple) #FIXED 'simple' xlink:href CDATA #REQUIRED xmlns:xlink CDATA #FIXED 'http://www.w3.org/1999/xlink' xlink:role CDATA #IMPLIED xlink:title CDATA #IMPLIED xlink:actuate (onRequest | onLoad | other | none) 'onRequest' xlink:show (new | replace | embed | other | none) 'new'">
<!ATTLIST anthology %simplelink;>
<!ATTLIST novel %simplelink;>
<!ATTLIST nonfiction %simplelink;>

分享到:
评论

相关推荐

    XML.in.a.Nutshell

    XML.in.a.Nutshell(英文版)

    C# 5.0 in a Nutshell 5th

    C# 5.0 in a Nutshell 5th

    R in a Nutshell

    R in a Nutshell, pdf version

    Python in a Nutshell Third Edition 2017

    Python in a Nutshell 2017 最新版

    C# 5.0 in a Nutshell, 5th Edition

    C# 5.0 in a Nutshell, 5th Edition 是英文的,别搞错了。

    Linux Kernel in a Nutshell

    Linux Kernel in a Nutshell Linux Kernel in a Nutshell

    Delphi in a Nutshell

    Delphi in a Nutshell is the first concise reference to Borland/Inprise Delphi available. It succinctly collects all the information you need in one easy-to-use, complete, and accurate volume that goes...

    USB in a Nutshell

    Starting out new with USB can be quite daunting. With the USB 2.0 specification at 650 pages one could easily be put off just by the sheer size of... None of these are detailed in the USB 2.0 Spec.

    Ruby In a Nutshell

    Ruby In a Nutshell

    C# 5.0 7.0 in a Nutshell EN

    C# 7.0 in a Nutshell EN,C# 5.0 in a Nutshell EN,英文原版PDF

    Java in a Nutshell(中文版)

    Java in a Nutshell(6th) 英文无水印pdf 第6版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除

    C# 6.0 in a Nutshell(6th) 无水印pdf

    C# 6.0 in a Nutshell(6th) 英文无水印pdf 第6版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系...

    C# 6.0 in a Nutshell.pdf

    Dive in and discover why this Nutshell guide is considered the definitive reference on C#. Get up to speed with all aspects of the C# language, from the basics of syntax and variables, to advanced ...

    C# in a nutshell

    Get up to speed on C# language basics, including ...Learn .NET topics, including XML, collections, I/O and networking, memory management, reflection, attributes, security, and native interoperability

    C# 7.0 in A Nutshell

    Dive in and discover why this Nutshell guide is considered the definitive reference on C#. Get up to speed on the C# language, from the basics of syntax and variables to advanced topics such as ...

    SQL in a Nutshell

    SQL in a Nutshell讲述sql的基础知识,可能对大家有帮助。

    C# 4.0 in a Nutshell

    C# 4.0 in a Nutshell

Global site tag (gtag.js) - Google Analytics