Saturday, 7 January 2012

CMT3315 - Lab 10 - XLink

Quick Questions

1. One of the advantages claimed for the “extended links”, that the W3C consortium intended to be part of the XLink language, was that the definition of a particular hyperlink could be located, not in the local resource (the document where the link starts), or the remote resource (the document where the link ends), but in a quite different “third party” document. Why might this be an advantage?

The main advantage of XLink is the ability to store links in a separate document, allowing you to alter the links without touching the actual document. This is great for reducing impact when doing changes but also allows you to change links on resources you might have no control over.

2. The XLink language provides an attribute for a hyperlink called show – it has several possible values. What is the effect of providing such a link with each of the following attribute values?
show=”replace”
show=”new”
show=”embed”
  Which of these three attribute values is the default?

show=”replace” is the default option

Longer questions

1. Here is an XML document:
<?xml version="1.0"?>
<!DOCTYPE memo SYSTEM memo.dtd">
<?xml-stylesheet href="stylesheet02.css" type="text/css"?>
</memo>
   <heading>memo 1334</heading>
<date>date: 11 November 09</date>
<time>time: 09:30</time>
<sender>from: The Managing Director</sender>
<addressee>to: Heads of all Departments</addressee>
  <message>I think we should be making wind-turbines. Have a look at this website. Tell me what you think. </message>
</memo>
The accompanying .dtd file looks like this:
<?xml version= "1.0" ?>
<!DOCTYPE memo [
<!ELEMENT memo (heading, date, time, sender, addressee, message)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT time (#PCDATA)>
<!ELEMENT sender (#PCDATA)>
<!ELEMENT addressee (#PCDATA)>
<!ELEMENT message (#PCDATA)>
]>
At the point where the document says this website, there is supposed to be a hyperlink that takes the reader to the website:
http://engineering.suite101.com/article.cfm/wind_power
a) Amend the document, so that the link is in fact there. Make any necessary changes to the .dtd file as well.

<?xml version="1.0"?>
<!DOCTYPE memo SYSTEM memo.dtd">
<?xml-stylesheet href="stylesheet02.css" type="text/css"?>
<memo xmlns:xlink="http://www.w3.org/1999/xlink">
<heading>memo 1334</heading>
<date>date: 11 November 09</date>
<time>time: 09:30</time>
<sender>from: The Managing Director</sender>
<addressee>to: Heads of all Departments</addressee>
<message>I think we should be making wind-turbines. Have a look at
<link xlink:type="simple" xlink:href="http://engineering.suite101.com/article.cfm/
wind_power">this website</link>.  Tell me what you think.
</message>
</memo>

<?xml version= "1.0" ?>
<!DOCTYPE memo [
<!ELEMENT memo (heading, date, time, sender, addressee, message)>
<!ATTLIST memo xmlns:xlink CDATA #REQUIRED>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT time (#PCDATA)>
<!ELEMENT sender (#PCDATA)>
<!ELEMENT addressee (#PCDATA)>
<!ELEMENT message (#PCDATA)>
<!ATTLIST link 
xlink:href CDATA #REQUIRED
xlink:type (simple|extended)  #REQUIRED>
]>

b) Suppose that the heading of one of the sections in the target website is <A NAME=“WE Elec Facts”>Wind Energy Electricity Facts</A>, including the tags as shown. What changes would you have to make to the link in the managing director’s memo, to make the hyperlink finish at that point rather than at the wind_power document as a whole?

2.  Here is another XML document:
<?xml version="1.0"?>
<!DOCTYPE memo SYSTEM memo.dtd">
<?xml-stylesheet href="stylesheet02.css" type="text/css"?>
</memo>
   <heading>memo 1335</heading>
<date>date: 11 November 09</date>
<time>time: 09:45</time>
<sender>from: The Managing Director</sender>
<addressee>to: Heads of all Departments</addressee>
  <message>I think we should be making solar panels. Have a look at this website. Tell me what you think. </message>
</memo>

At the point where the document says this website, there is supposed to be a hyperlink that takes the reader to a suitable website. Find one, and amend the document, so that the link is in fact there. Is it necessary to make any changes to the .dtd file, or can we use the file as you amended it before?

<?xml version="1.0"?>
<!DOCTYPE memo SYSTEM memo.dtd">
<?xml-stylesheet href="stylesheet02.css" type="text/css"?>
</memo>
   <heading>memo 1335</heading>
<date>date: 11 November 09</date>
<time>time: 09:45</time>
<sender>from: The Managing Director</sender>
<addressee>to: Heads of all Departments</addressee>
 <message>I think we should be making solar panels. Have a look at 
  <link xlink:type="simple" 
xlink:href="http://vincent-lui.suite101.com/solar-paneling-for-the-home-a226122">this website</link>.
  Tell me what you think. 
 </message>
</memo>

No comments:

Post a Comment