..


Sponsored Links

Set in XML with XLink links

Article written by Luca Ruggiero

XLink is an acronym for XML Linking Language and is a standard recommended by the W3C for creating links to files and images through an XML structure.

The philosophy of creating a link with XLink is similar to the traditional method of creating a hyperlink to HTML tags through <a> but is much more powerful and functional.

So imagine you want to run a gallery dedicated to the Queen through XML.

The basic syntax for creating a link in an XML document with XLink is as follows:






 <? Xml version = "1.0" encoding = "UTF-8"?>









 <queen xmlns:xlink="http://www.w3.org/1999/xlink">



    



 <Band



        



 xlink: type = "simple"



        



 xlink: href = "http://localhost/queen/freddie-mercury.html">



        



 Voice and piano: Freddie Mercury



    



 <band>



    



 <Band



        



 xlink: type = "simple"



        



 xlink: href = "http://localhost/queen/brian-may.html">



        



 Electric Guitar: Brian May



    



 <band>



    



 <Band



        



 xlink: type = "simple"



        



 xlink: href = "http://localhost/queen/john-deacon.html">



        



 Bass: John Deacon



    



 <band>



    



 <Band



        



 xlink: type = "simple"



        



 xlink: href = "http://localhost/queen/roger-taylor.html">



        



 Drums: Roger Taylor



    



 <band>







 </ Queen>



The basic element of the XML structure just presented is the "queen" who, through the namespace xmlns: xlink, the DTD defines dell'XLink directly from the W3C site.

Inside we find elements of "band" for the definition of the individual elements of the group to which they associate (as Namespaces) attributes xlink: type and xlink: href attribute to define, respectively, the type of link and path of the page link.

The default values ​​that we can use for xlink: type are as follows:

  • Simple: simple link;
  • Extended: Multi-link resources;
  • locator: links to an external resource;
  • resource: a resource to internal links;
  • arc: special rule across multiple resources;
  • title: XLink element for another descriptive title.
To open the link in a new window use the attribute xlink: show and set its value to new, as in the following:





 <Band



    



 xlink: type = "simple"



    



 xlink: show = "new"



    



 xlink: href = "http://localhost/queen/brian-may.html">



    



 Electric Guitar: Brian May







 <band>



In the same category ...
E-Learning
CSS (Course) CSS (Course)
Web Design and Accessibility according to W3C CSS and XHTML. Starting from 29 €.
XML (Course) XML (Course)
Creation of XML structures, XSL and other languages ​​extensible. Starting from 29 €.
Sponsored Links