..


Sponsored Links

Set a basic link with XML Base

Article written by Luca Ruggiero

In the tutorial dedicated to XLink we saw how to create links through an XML document.

Let's see how life easier by using the XML element: Basis for defining the base URL to link documents in our XML file.

The operation of XML Base is similar to HTML tags <base>, whose operation is described in detail in this article .

In the article to XLink, which I mentioned earlier, we created an XML file on the well-known musical group Queen.

Here the same example here and adapt to its internal management of the basic link with XML: Basic, as in the following:






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









 <Queen



    



 xml: base = "http://localhost/queen/"



    



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



    



 <Band



        



 xlink: type = "simple"



        



 xlink: href = "freddie-mercury.html">



        



 Voice and piano: Freddie Mercury



    



 <band>



    



 <Band



        



 xlink: type = "simple"



        



 xlink: href = "brian-may.html">



        



 Electric Guitar: Brian May



    



 <band>



    



 <Band



        



 xlink: type = "simple"



        



 xlink: href = "john-deacon.html">



        



 Bass: John Deacon



    



 <band>



    



 <Band



        



 xlink: type = "simple"



        



 xlink: href = "roger-taylor.html">



        



 Drums: Roger Taylor



    



 <band>







 </ Queen>



All we do is set within the tag "queen", the root of the XML document, the attribute xml: base value of assigning it as the base URL to which the HTML file specified in the individual nodes will refer.

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