Essential XML for Web Professionals by Dan Livingston Essential XML for Web Professionals by Dan Livingston
Chapter Navigation Map

Chapter 7
XLink: Creating Links in XML

Examples

XLink is a way to create links in XML; it is much more powerful than linking in HTML. XLink can create links that have multiple starting points and multiple ending points. It can even define links that have both starting and ending points in a different location then the XLink code itself. A simple example:

<contactLink xlink:type="simple" xlink:href="contact.xml">
	Contact us!
</contactLink>

A more complicated example:

<drugLink xlink:type="extended">

	<!-- two local resources -->
	<chemName xlink:type="resource" 
		xlink:label="chemicalName">
		hydrachloroniametahexacyocaine
	</chemName>
	<marName xlink:type="resource" xlink:label="marketName">
		BreatheEasy
	</marName>

	<!-- two remote resources -->
	<effects xlink:type="locator" 
		xlink:href="http://www.shelleybio.com/effects"
		xlink:label="effects" />
	<sideEffect xlink:type="locator" 
		xlink:href="http://www.shelleybio.com/sides"
		xlink:label="sideEffects" />

	<!-- three traversals -->
	<link1 xlink:type="arc" 
		xlink:from="chemicalName" 
		xlink:to="effects" 
		xlink:show="replace"
		xlink:actuate="onRequest" />
	<link2 xlink:type="arc" 
		xlink:from="marketName" 
		xlink:to="effects" 
		xlink:show="replace"
		xlink:actuate="onRequest" />
	<link3 xlink:type="arc" 
		xlink:from="chemicalName" 
		xlink:to="sideEffects" 
		xlink:show="replace"
		xlink:actuate="onRequest" />

</drugLink>

Prentice Hall PTR home | Essential Series home
© 2002 Prentice Hall PTR
13 12 11 10 9 8 7 6 5 4 3 2 1