XLINK1.0 learning notes

xiaoxiao2021-03-06  110

XLINK1.0 learning notes

Zhang Xiaoot

1, XLINK specification is used to describe and create link language norms between resources in XML documents, current W

3C

This working group has been dissolved because the work has been completed. This specification defines two link declaration types, that is, simple (type Simple) and extension (type extended), in fact, simple link is a simple form of expansion links.

2. To declare a link to an XML document, you must define this namespace in the elements of this declared link: http://www.w3.org/1999/xlink. Then add the relevant attributes.

E.g:

XLINK: TYPE = "Simple"

XLINK: href = "authors.xml"

XLINK: Role = "Author List"

XLINK: Title = "Author List for Example"

XLINK: Show = "Replace"

XLINK: ACTUATE = "OnRequest" />

Note: If you want to increase the XLINK attribute in your own, you need to define the properties of the link element in in your own element, otherwise, the verification processor will not recognize XLink: *. For the above example, it should be the following form in the DTD:

Attrlist authors

XMLns: XLINK CDATA #fixed "http://www.w3.org/1999/xlink"

XLINK: TYPE (SIMPLE | Extended | Locator | ARC | Resource) "SIMPLE"

XLINK: HREF CDATA #Required

XLINK: Role Cdata #implied

XLINK: Title Cdata #implied

XLINK: SHOW (New | Replace | Embed | Other | NONE) "Replace"

XLINK: ACTUATE (ONLOAD | OnRequest | Other | NONE) "OnRequest">

3. There are several types of expansion links, in fact, refer to the type of ARC: Inbound, Outbound, Third-Party; Outbound means the starting point of the link is local resource, and the end point of the link is remote resource (Remote) Resource, Inbound means that the starting point of the link is a remote resource, and the endpoint resource is local resources, and third-party is a remote resource. This local resource refers to the resource specified by the specific value, and the remote resource refers to the resource specified by the URI by reference, even if the resource is in the same XML document, if it is specified by the URI, it is called remote. Resource.

4, in Simple, Extended, Locator, ARC, Resource, Title This class's properties only type must be needed, and the HREF attribute of the Locator element is necessary, all other properties are optional. .

5. Declare the link to the extended link to have Locator, Resource, ARC, TITLE sub-elements, Locator to define remote resources, resource is used to define local resources, ARC is used to define the direction arc between resources, Title is used to define some Description of natural language.

6, XLINK: TYPE: Used to specify the type of link element, the value can be: 2 Simple: indicates elements are simple links

2 extended: indicates that it is an extension link

2 Locator: It is a remote resource

2 Resource: It is a local resource

2 Arc: indicates the arc of the link resource

2 Title: Representation is a link description of natural language

7, XLINK: SHOW is used to define how the target content is displayed to the user, and the value can be:

2 New: The target content is displayed in a separate context (in the browser, it may be a new browser window).

2 Replace: The target content should replace the content in the original context (this is a usual link behavior).

2 Embed: This content is embedded in the link location in the document (instead of the link represents itself).

2 Other: This link does not specify the behavior of being accessed. If this value is as this value, this document will contain additional tips about this link, such as a tag that describes the purpose of this link (dedicated type of document).

2 None: This link does not specify the visited behavior. This is, this document does not contain other tips on how to access this link.

8, XLINK: Actuate property definition When to trigger this link, the value is as follows:

2 OnRequest: The user must take action to trigger this link, which is similar to the HTML hyperlink, and the user must click on the link text to activate this link.

2 Online: This link is automatically activated when loading a document. It is very useful when the XLink: Show property is Embed, and there are also some applications when it is New (for example, when opening the source document, an additional context window is automatically opened, including the terminal resource of the link).

2 Other: This link does not specify the behavior when the link is activated. If the actuate property is this value, the document will contain additional tips for activating this link.

2 None: This link does not specify a behavior when activating this link. This is, this document does not return other tips that activate this link.

9, the resource element is used to define local resources. This element contains four properties of XLink: Type, XLink: Role, XLink: Title, XLink: Label, where XLink: Type is Resource.

10, Locator element is used to define remote resources, including XLink: Type, XLink: HREF, XLINK: ROLE, XLINK: TITLE, XLINK: Label five properties, where XLINK: Type's value is LOCATOR, and HREF defines one Uri used to find remote resources, note that if the processor can understand the XPointer reference, then this URI can include XPointer references to the XML document subset.

11, the ARC element defines the link relationship between resources, including XLink: Type, XLink: Arcrole, XLink: Title, XLink: Show, XLink: Actuate; XLink: from, XLink: TO. The value of TYPE is Arc, while the value of XLink: from and XLink: TO is the value of XLink: Label in the Resource and Locator elements.

12. If there is no ARC element in a XLINK link, XLINK will assume that there will be implicit ARC elements between each Locator and Resource elements, so only explicit definitions ARC make sense. 13. If there are multiple ARC elements to define the same starting resources and end resources, only the first one will be parsed, and this is not allowed in some resolution, so it is best not to define the repeated Arc element.

14, a link application In order to find the end resource from the starting point, it needs to locate the position of the starting resource, which is not a problem for Outbound ARC, because the starting point resources are not the link element itself is its child element, but for Inbound and Third-Party type ARC is a problem. In order to solve this problem, XLINK provides a link to the link to define all links (generally a link document, so that you can easily manage links And this document must be XML), and provide an ARC, the endpoint resource of the ARC is the link library of XLINK, and the show property must be ignored, but this Arc Arcrole must be: http://www.w3.org / 1999 / XLINK / Properties / LinkBase, for example:

We have the following link library Menulink.xml:

XLINK: TYPE = "Extended"

XLINK: Title = "See Other Parts of Menu">

XLINK: href = "menu1.xml"

XLINK: label = "MenuPage

1"

XLINK: Title = "Beverage" />

XLINK: href = "menu2.xml"

XLINK: label = "MenuPage

2"

XLINK: Title = "APPETIZERS" />

XLINK: href = "menu3.xml"

XLINK: label = "MenuPage

3 "

XLINK: Title = "Sandwiches" />

XLINK: href = "menu4.xml"

XLINK: label = "MenuPage

4 "

XLINK: Title = "Desserts" />

XLINK: from = "MenuPage

1"

XLINK: TO = "MenuPage

2"

XLINK: Show = "Replace"

XLINK: ACTUATE = "OnRequest" />

XLINK: from = "MenuPage

2"

XLINK: TO = "MenuPage

3 "

XLINK: Show = "Replace"

XLINK: ACTUATE = "OnRequest" />

XLINK: from = "menupage3"

XLINK: TO = "MenuPage

4 "

XLINK: Show = "Replace"

XLINK: ACTUATE = "OnRequest" />

Then, we have the following menu1.xml (which can be applied to all menu pages :)

XLINK: label = "linkbasestart" />

XLINK: href = "menulink.xml"

XLINK: label = "linkbasend" />

XLINK: Arcrole = "http://www.w3.org/1999/xlink/properties/linkbase"

XLINK: from = "linkbasestart"

XLINK: to = "linkbasend"

XLINK: ACTUATE = "Online" />

coffee

$ 0.99

Tea

$ 1.09

SODA

$ 1.25

If we have to add other menus, we can change the link library, do not need to modify the Menu1.xml file.

转载请注明原文地址:https://www.9cbs.com/read-125365.html

New Post(0)