Wednesday, 31 March 2010

CMT3315 – Laboratory 17 – 3 March ’10

Quick Questions

1. The reason is that CSS is much easier to use and learn, which makes it easier to maintain. CSS does have some
limitation which is why its sensible to use CSS when you can but use XSL when you need it.

2.They both work and are legitament syntax, so therefore it doesnt matter which one you chose.

Longer Question

1. The following is used to display pieces of data from the xml document:
//policies/policy/policyholder/
/policies/policy/@type
/policies/policy/claims/claim/year
/policies/policy/claims/claimdetail

Below are the more simple ways of doing it:
//policy-holder
//@type
//year
//details

Lecture Reflection-WEEK 17 – Function Elements of XSL

This is an extension of the past week where insights to the functional elements of XSL were looked at.

Here is a list of the functional elements of XSL that was discussed in class during week 17: -


1 <xsl:value-of> element can be used to extract the value of an XML element and add it to the output stream of the transformation.

2 <xsl:for-each> element can be used to select every XML element of a specified node-set.

3 <xsl:sort> element is used to sort the output.

4 <xsl:if> element is used to put a conditional test against the content of the XML file.

5 <xsl:choose> element is used in conjunction with <xsl:when> and <xsl:otherwise> to express multiple conditional tests.


The following code snippet example is from my coursework for this module which required XSL: -



<xsl:choose>

<xsl:when test="@malady = 'chest affections'">

<td bgcolor="#ff00ff">

<xsl:value-of select="@malady"/></td>

<xsl:otherwise>

<td>"no catagory"</td>




www.ronnysmarket.com
www.ronnysmarket.com/catalog/main

http://www.ronnysmarket.com
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 16 – 23 February ’10

Quick Questions

1. The JDK package called JAXP contains classes that provides three XML parsers which are “DOM”,”SAX” AND “STAX”

2. A DOM parser is liable to cause problems as the XML document when parsed into a DOM object will become larger than the existing file. This will be stored into the computers primary memory such as the “RAM” which will hinder the performance. The computer could crash as a result. The alternative to using a DOM parser is an SAX parser which only views the content bit by bit.

Longer Questions

A) The “endElement” prints out the value of “”qualifiedName” which is passed into the method “endElement” as an argument.

B) The startElement has a “for loop” which gets the values from the array attribute“a”. In this case the values from the getQName() and getValue() method’s are being retrieved and the for loop is being used to access every position of the array.

C) The “characters()” method takes 3 arguments and one of which is an array called “ch”. This method first turns array or characters “ch” into string “claimString” and then prints out part of the string that we made.

Lecture Reflection-WEEK 16 – XML Transformation (XSL)

In this lecture we had a recap on XSL (studied first in week3).

XSL is able to:

1 Transform XML documents into new XML documents.
2 Generate web pages from XML documents as well as HTML or XHTML.
3 Generate PDF documents from XML documents.

During this lesson we looked at examples of XSL and XPATH and I found it so much easier to understand because of the greater knowledge I have on this subject as opposed to what I did in week 3 (when we first looked at and studied XSL).

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 15 – 10 February ’10

Quick Questions

1. A DOM is an interface that allows scripts and programs to dynamically access and update contents, style and the structure of documents. It defines the way in which a document is accessed by also defining the logical structure of documents.

2. XHTML is a stricter and cleaner version of HTML. With normal html you can have certain tags that do not have a closing tag but with XHTML closing tags are enforced and results in a much cleaner and tidier document.


Longer Questions

1.
a) The line bellow is an XML declaration used for XHTML documents

<?xml version="1.0"?>                

b) The line bellow indicates the DOCTYPE and states where to find the DTD file. This DOCTYPE is used to validate the document as correct XHTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">



c) The line bellow specifies the xml namespace for a document, and is required in XHTML documents

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">


2.The 10 lines on the next page are javascript code and the function of the code will in the end will output information obtained from the document using the “documentwrite()” function. The document write function is the equivalent of the “echo” function from the server side scripting language known as PHP in the sense that it is used to output information.

3. The line “<-- and a line //-->”, is a comment.


Lecture Reflection-WEEK 15 - SAX

In the mid 1998 XML parser was developed which is a type of SAX. This was developed before the DOM was published by the W3C organisation.
The benefits that SAX parsers have over DOM-style parsers such as the quantity of memory that a SAX parser must use in order to function is typically much smaller than that of a DOM parser. The Document Object Model must be built in the computer’s memory before any data is extracted which might be slow if used with a large XML document. This could result in exceeding the computer’s memory limit causing errors such as system crash. Sax is an event driven parser and works in a more linear format and responds to commands as they come.

The following shows how SAX handles code


XML document: -


<?xml version="1.0"?>

<doc><para>Hello, world! </para></doc>


SAX will break the structure down into a series of linear events: -

1 start document
2 start element: doc
3 start element: para
4 characters: Hello, world!
5 end element: para
6 end element: doc
7 end document

Following methods required for the program to use the parser: -

1 characters( ) :Receives notification of the character data inside an element.
2 startElement( ) :Receives notification of the start of an element.
3 endElement( ) :Receives notification of the end of an element.
4 startDocument( ) :Receives notification of the start of a document.
5 endDocument( ) :Receives notification of the end of a document.
6 processingInstruction( ) :Receives notification of a processing instruction.
http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 14 – 27 January ’10

Quick Questions

1. The reason we would want to convert XML into a Document Object Model is so that we can access the nodes and manipulate their data. This can be done by using suitable languages such as javaScript as long as the document is a DOM. We can also see the document as a tree structure.

2.Object oriented programming ensures objects are a self contained portion of a program that possesses properties and methods. Therefore when an xml document is converted into a DOM object, you would expect it to possess the property that told you what the prior element in the document was.

3. Other languages will be able to able to access the content of a DOM but the characterisitics of these languages require object orientation. Languages such as Perl, python and java will be able to access DOM.


Longer Questions

a)

<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

</xs:schema>



b)


c)

<xs:complex Type name=”electronice_payment_type”>

</xs:element>

<xs:element Type name”electronic_payment_type”/>

<xs:sequence>

<xs:element name”Sender”type=”institution_type”/>

<xs:element name”Reciever”type=”institution_type”/>

<xs:element name”Transaction”type=”institution_type”

maxOccurs=”unbounded”/>

</xs:sequence>



d)



e)


f)
xs:complexType name=”transection_type”

xs:all>

xs:slement name=”number” type=”xs:integer”/>

xs:element name=”amount”>

xs:simpleType>

xs:restrcition base=”xs:decimal”>

xs:fractionDigits value”2”>

/xs:restriction>



xs:element name=”date” type=”xs:”>

xs:element name=”recounciled” type=”xs:boolean”>

/xs:all>




g)


h)


xs:complex Type name=”Institution”

xs:all>

xs:slement name=”company” type=”xs:string”/>

xs:element name=”Account” type="xs:string">

xs:element name=”account number” type="xs:integer">

xs:element name=”address” type="xs:string">



/xs:all>



</xs:complexType>



i)


j)


<xs:element name="Address">

  <xs:complexType>



    <xs:sequence>

      <xs:element name="Line 1" type="string"/>

    <xs:element name="Line 2" type="string"/>

    <xs:element name="city" type="string"/>

    <xs:element name="Postcode" type="string"/>

    </xs:sequence>



  </xs:complexType>

</xs:element>



Lecture Reflection-WEEK 13 – 14 – XML DOM


During the two weeks of week 13 and week 14 we did studies on DOM. DOM provides a practical way for modification as well as the creation of XML documents. This works by creating objects that represent XML documents of components of the document, whereby allowing the DOM access to manipulate the properties contained within the object. The XML DOM defines a standard way for accessing and manipulating XML documents and it is a W3C standard, The DOM presents an XML document as a tree-structure.

DOM is separated into 3 different parts / levels:

1. Core DOM - standard model for any structured document.
2. XML DOM - standard model for XML documents.
3. HTML DOM - standard model for HTML documents.

Any computer can operate DOM, but the use of JavaScript would be ideal to use as it is simple, free to use and ALL modern web browsers support this. According to DOM, everything in an XML document is a node.

DOM States: -

• The DOM models an XML document as a hierarchy of nodes.
• In fact, everything in an XML document is a node.
• At the top of the tree is a document node.
• Every other node is a child node to some other node.
• The elements are element nodes
• Each piece of text is a text node
• Each attribute is an attribute node
• Each comment is a comment node

Here is an example of how to make an item a DOM object: -


function loadXMLDoc(docname)

{

   if (window.XMLHttpRequest)

   {

      xhttp=new XMLHttpRequest();

   }

   else

   {

      xhttp=new ActiveXObject("Microsoft.XMLHTTP");

   }

   xhttp.open("GET",docname,false);

   xhttp.send("");

   return xhttp.responseXML;

}


Once the XML document is loaded, we can direct the XML document by using a series of functions.

For Example

x.getElementsByTagName(name) - gets all elements with a specified tag name.
x.appendChild(node) - inserts a child node to x.
x.removeChild(node) - removes a child node from x.

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 13 – 20 January ’10

Quick Questions

1. A "complex type" Defines a complex type element whereas a "simple type" defines a simple type.
Simple type specifies the constraints and information about the values of attributes or text only elements, Whereas a complex type can contains elements and children’s.

2. XML schema's are defined as XML documents, can be checked by XML parser and edited by XML editor which is why it is advantageous.

3.Three random predefined data types within XML schema definition Language are as follows: -
1. String
2. Date
3. Double

Longer Questions: -
1.

xmlns:xs="http://www.w3.org/2001/XMLSchema"

The component above specifies the namespace "http://www.w3.org/2001/XMLSchema" where the data types and elements come from.The namespace is prefixed with xs.

<xs:=schema

The above component specifies the root element and as you can see is a start tag which will require an end tag at the end of the document



2. a)

<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

</xs:schema>




b)


c)

<xs:complex Type name=”electronice_payment_type”>

</xs:element>

<xs:element Type name”electronic_payment_type”/>

<xs:sequence>

<xs:element name”Sender”type=”institution_type”/>

<xs:element name”Reciever”type=”institution_type”/>

<xs:element name”Transaction”type=”institution_type”

maxOccurs=”unbounded”/>

</xs:sequence>



d)

e)



f)

xs:complexType name=”transection_type”

xs:all>

xs:slement name=”number” type=”xs:integer”/>

xs:element name=”amount”>

xs:simpleType>

xs:restrcition base=”xs:decimal”>

xs:fractionDigits value”2”>

/xs:restriction>



xs:element name=”date” type=”xs:”>

xs:element name=”recounciled” type=”xs:boolean”>

/xs:all>



Lecture Reflection-WEEK 13 – 14 – XML DOM


The lecture reflection for this week is discussed in the blog for week 14
http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 12 – 16 December 09

Quick Questions

1. The text “Croydon Tramlink” on firefox explorer will be underlined and most likely highlighted in a different colour to indicate that it is a link where as on explorer the link is not supported and is not even highlighted or underlined.

2. I would chose XML schema’s over DTD’S because DTD ‘s has limitation on the description it can give about the document structure and uses a strange archaic format. However xml schema uses xml therefore can be parsed through an xml parser. The xml schema addresses the shortcomings of DTD’S and has the ability to describe complex XML types. There are also other features such as the “minOccurs” and “maxOccurs” which gives information on the amount of times each element will appear within a certain document.

Longer Questions

Bellow is the required XML schema document that I had to create: -


<?xml version="1.0" encoding="ISO-8859-1" ?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="book">

  <xs:complexType>

    <xs:sequence>

    <xs:element name="title" type="xs:string"/>

<xs:element name="author" type="xs:string"/>

<xs:element name="character">

<xs:complexType>

<xs:sequence>

<xs:element name="name" type="xs:string"/>

<xs:element name="friend-of" type="xs:string" minOccurs="0"/>

<xs:element name="since" type="xs:string"/>

<xs:element name="qualified" type="xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

    </xs:sequence>

   <xs:attribute name="isbn" type="xs:string" use="required"/>

  </xs:complexType>

</xs:element>



</xs:schema>




Lecture Reflection-WEEK 11 – 12 – XML Schema


An XML Schema describes the structure of an XML document and it is an XML-based alternative to DTD. An advantage of an XML schema over a DTD is that the schema uses XML for its coding therefore ensures a better understanding for someone that already knows how to use XML. This also ensures that the schema is parsed using an XML parser. An XML schema also offers more description then a DTD.
XML Schema language is sometimes referred to as XML Schema Definition (XSD). XML Schema is a W3 recommendation and it is thought of as the successor of DTD since they are extensible to future additions, support data types and namespaces, and they are more powerful than DTD.

There are two types used in an XML schema: -

1.Simple Type= Simple types contain only text. They don’t have child types. The element concerned doesn’t have attributes.
2.Complex Type= the element has one or more attributes, or one or more child elements, or both.

Example

XML document: -

<?xml version="1.0"?>

<note>

  <to>Tove</to>

  <from>Jani</from>

  <heading>Reminder</heading>

  <body>Don't forget me this weekend!</body>

</note>



XML Schema for the above document: -


<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://www.w3schools.com"

xmlns="http://www.w3schools.com"

elementFormDefault="qualified">



<xs:element name="note">

  <xs:complexType>

    <xs:sequence>

      <xs:element name="to" type="xs:string"/>

      <xs:element name="from" type="xs:string"/>

      <xs:element name="heading" type="xs:string"/>

      <xs:element name="body" type="xs:string"/>

    </xs:sequence>

  </xs:complexType>

</xs:element>



</xs:schema>





http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 11 – 9 December 09

Quick Questions

1. Its about centralising the code within a document so that if you wish to change the attributes of the links of one or more document, then you only need to edit the third party document. This is similar to css as css is a separate document used to style an html document. In this case a third party document in xlink is used to edit the attributes of links contained in other documents. The advantage is the ability to change attributes of links contained in many documents by editing only one document (third party document) therefore making the editing process a little simpler.

2. Show="embed" (The link replaces the element link)
Show="new" (This opens up a new window)
Show="replace" (The content is loaded up on the current window, this is also the default attribute value)


Longer Questions

1.
(a) The following creates a link for the words “this website” contained within the message tag.

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

<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>


(b) The following will make the hyperlink finish at a certain part of the document rather than the wind_power document as a whole.

<message>i think we should be making wind-turbines. Have a look at <A HREF=“= “http://engineering.suite101.com/article.cfm/wind_power#WE Elec Facts”> this website.</A> Tell me what you think.</message>

2. The following creates a link for the words “this website” contained within the message tag. This time however the link takes the user to www.google.com


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

<message>i think we should be making wind-turbines. Have a look at <Link xlink:type = "simple" xlink:href = “www.google.com”> this website.</Link> Tell me what you think.</message>

</memo>




Lecture Reflection-WEEK 11 – 12 – XML Schema


The lecture reflection for this week is discussed in the blog for week 12
http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 10 – 2 December 09

Quick Questions

1. With CSS the most specific rule will be used

2.No, because the number 10000 is within a the sentence, and the sentence is used as
an element, the only way you can get the number on its own is if
the number 10000 is contained as an element on its own


Longer Questions

1. <?xml version="1.0"?>

<!DOCTYPE chemElements SYSTEM "chemElements2.dtd">

<?xml-stylesheet href="stylesheet01.css" type="text/css"?>



2. The following are xpath expressions used to get attributes, nodes. The expressions can also contain conditions such as the ones bellow demonstrates: -
a)


b) //tracks[@total="5"]   <<<This is a condition where tracks is returned if the attribute value of “total” is equal to 5

c) //title[contains(name(), "Pendericki")]  <<<<This condition returns the title if the name is equal to “pendericki”

d) //title[string-length(name())>11] <<<This condition returns the title if the name length is greater than 11 characters

e) /musicList/cd/sibling::    <<<<this expression does not contain a condition but will return the “sibling”.  This expression goes into the parent tag “musicList” and finds the child tag “cd” inside it, which contains the “sibling” element.




Lecture Reflection-WEEK 10 – Hyperlinks, Anchors and X-Pointers

This week was spent studying hyperlinks and anchors. A hyperlink allows a user to select images, other web pages, movies etc and links them directly to the correct resource using HTML.
An anchor is a specific location within a web page that can be jumped to by clicking onto a hyperlink.

Example of a hyperlink in a HTML: -


<a href="url">Link text</a>


o The href attribute defines the link address.
o The element acts as a description for the link, it doesn't have to be text as it can be an image or any other HTML element.

Example of a anchor inside an HTML: -


<a name="content">the main content of the document</a>

A link to the above anchor from the same document

<a href="#content">Jump to the main content section</a>



XLink describes hyperlinks that offer a greater degree of functionality than those in HTML.
Simple links and extended links are two different types of hyperlinks in XML.
Extended links can be multidirectional, linking from, within, and between XML documents.

Simple links are unidirectional and therefore offer no more functionality than hyperlinks in HTML.
Hyperlinks in XML = XLinks
Anchors = XPointers.

To write an XLink in XML the XLink name space must be in the beginning of the document: -

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

Simple XLink Demonstration

1. Declare the namespace

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


2. Make the link

<homepage xlink:type="simple"

xlink:href="http://xml4u.blogspot.com/">Visit My Blog</homepage>

The xlink:type="simple" creates a simple, two-ended link (means "click from here to go there")

Extended XLinks = these can connect more than two documents and the link specification can be in any of the documents.

XPointers = these can e used to use a specific part of a document without the necessitate of an anchor.
http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 08 – 18 November 09

Quick Questions

1.
a. You cannot rearrange the order with CSS

b. However you can specify items to be displayed on its own e.g. you can display the title on its own, or even the title and the judgement.

c. XML document(s) will specify which CSS file to use in the following format: -


2. A URL, is a type of URI that's used to describe the location of a specific document. A URL doesn't define the type of content to be found (texts, images, movies, etc.), it only says where and how to find it.

3.XML allows namespaces so that the elements and attributes do not clash as two different elements with the same name can be uniquely identified by having different namespaces allocated to them.
This helps when more than one programmer is working with the same piece of code as two people might use the same element name for two different purposes. Namespaces allows the programmer to specify what the element is used for, therefore reducing any risks of using the wrong element as the element will have been made with its own unique namespace.


Longer Questions

The following style sheet was used to display the poem along with the text of “Chapter 2: Volcanic winter” correctly: -


chapterHead{

display:block;

margin:1em;

color:"blue"; text-align:left;

font-family:"Platino",Times New Roman, serif;

font-style:italic;

font-weight:bold;

font-size:24px;

}

poem{

display:block;

margin:2em;

text-align:left;

font-family:"Platino",Times New Roman, serif;

font-weight:bold;

font-size:12px;

background-color:#FCFBC4;

}



Lecture Reflection-WEEK 8 – Xpath


XSLT and XPointer both operate with Xpath which is a language which addresses parts of a XML document. “XPath is a syntax used to describe parts of an XML document”. With XPath an XML document is treated as a hierarchy of nodes.
• The seven kinds of nodes in XPath are:
– root,
– element,
– attribute,
– text,
– namespace,
– processing-instruction,
– and comment.
The reason why we use XPath is because an XML document can act like a database for information and XPath is used to point to a certain node to retrieve that information. Bellow is an example of a book element being retrieved by using an XPath expression: -

/bookstock/book

XPath also provides the usage of conditions. Bellow is an example of a condition whereby the book element is received ONLY IF the name is “Moby Dick”: -

/bookstock/book[name()=“Moby Dick”]

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 07 – 11 November 09

Quick Questions
1. .
a. People who prepare XML documents sometimes put part of the document in a CDATA section because
the parser is liable to interprete some characters such as “&” and “<”as XML syntax

b. A CDATA section is indicated in the following manner: -


<![CDATA[Begining]]> End


c.

There is a substitutional method whereby characters “<” is replaced by “<” and “&” is replaced by “&” which should achieve the same effect.

2. A parser is a software application used to interpret text documents one character at a time. There are two kinds, one of which ensures the document is well formed whereas the other ensures the document is valid.

3. A dtd file cannot insist the element appears exactly 3 times.


Longer Question

1.
a. The following is a suitable prologue for the document we were looking at: -

<?xml version= “1.0”?>

<!DOCTYPE book SYSTEM “secondChapter.dtd”>




b) The following is a dtd file to accompany the document we studied: -

<?xml version="1.0"?>

<!DOCTYPE bookproject[

<!ELEMENT bookproject(titlepage,author+,publisher,location,titlepageverso,content+)>



<!ELEMENT titlepage (#PCDATA)>

<!ELEMENT author (#PCDATA)>

<!ELEMENT publisher(#PCDATA)>

<!ELEMENT location (#PCDATA)>

<!ELEMENT titlepageverso(#PCDATA)>

<!ELEMENT content(chapter1,chapter2,chapter3)>

<!ELEMENT chapter1 (#PCDATA)>

<!ELEMENT chapter2 (#PCDATA)>

<!ELEMENT chapter3 (#PCDATA)>

<!ELEMENT (#PCDATA)>

]>



c. I have taken careful consideration to the question asked and created the following code to mention of the poets at Geneva. I have also ensured that it mentions the pyroclastic flows and Mount Tambora and Sumbawa and the year without a summer and the famines.

<?xml version="1.0"?>

<chapter2>

<line1>A volcanic winter is very bad news.</line1>

<line2 key= “Mount Tambora”>The worst eruption in recorded history happened at Mount Tambora in 1815.</line2>

<line3 key1= “pyroclastic” key2= “Sumbawa”>It killed about 71 000 people locally, mainly because the pyroclastic flows killed everyone on the island of Sumbawa and the tsunamis drowned the neighbouring islands, but also because the ash blanketed many other islands and killed the vegetation. </Line3>

<line4>It also put about 160 cubic kilometres of dust and ash, and about 150 million tons of sulphuric acid mist, into the sky, which started a volcanic winter throughout the northern hemisphere.</line4>

<line5>The next year was the year without a summer.</line5>

<line6>No spring, no summer – it stayed dark and cold all the year round.</line6>

<line7>This had its upside. In due course, all that ash and mist in the upper atmosphere made for some lovely sunsets, and Turner was inspired to paint this.</line7>

<line8 poet= “Lord Byron”>The Lakeland poets took a holiday at Lake Geneva, and the weather was so horrible that Lord Byron was inspired to write this.</line8>

<line9>The bright sun was extinguish'd, and the stars Did wander darkling in the eternal space, Rayless, and pathless, and the icy earth Swung blind and blackening in the moonless air; Morn came and went – and came, and brought no day.</line9>

Mary Shelley was inspired to write Frankenstein.

The downside was that there were famines throughout Europe, India, China and North America, and perhaps 200 000 people died of starvation in Europe alone.

</chapter2>




Lecture Reflection-WEEK 7 – Ajax (Asynchronous JavaScript and XML)

To create interactive web applications (client side) a good way to do it is by using Ajax, which is a solid web development technique.
A section on a page can be refreshed without the whole page doing so, so therefore certain sections can stay up to date with new information without the host having to keep refreshing the entire page.

Ajax consists of: -

1 Open Standards Based.
2 Usability and User Experience.
3 Cross Browser and Cross Platform.
4 Benefits of Regular Web Applications.
5 Low Incremental Cost.

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 06 – 4 November 09

Quick Questions

1. A DTD is used to describe a document. It is supposed to define the legal building blocks of an XML document. The document structure is defined with a list of legal elements and attributes.

2. You should do the following if you realise that the text contains some arabic characters:

Change the XML declaration to


<?xml version= “1.0” encoding=”ISO 8859-6”?>

3. Can you use a binary graphics file in an XML document?

Yes, you can use binary code in an XML document inside the tags however; the tags must specify that the data is binary.


Longer Questions


1.

a. <targLangPhrase> is used instead of < russianPhrase> because the targLang has already be given the attribute "Russian", therefore not needing <russionPhrase>

b.
The following is a suitable prologue for an xml document, and can be used for the XML document related to this question:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>


c.

<?xml version="1.0"?>

<!DOCTYPE phrasebook [

<!ELEMENT phrasebook (section,phrasegroup)>

<!ELEMENT section (#PCDATA)>

<!ELEMENT phrasegroup (#PCDATA)>

]>




d. There are no differences in the XML declaration

2.
a. I was instructed to create the following document: -

<?xml version="1.0">



<!DOCTYPE bookproject SYSTEM "bookproject.dtd"><bookproject>

<titlepage>Toba:the worst volcanic eruption of all</titlepage>

<author>John Platts, Jack Brilliant, Jill Bright, Joe Clever</author>

<publisher>Middlesex Press </publisher>

<location>hendon</location>

<titlepageverso>

Copyright 2009 Middlesex press, Published by Middlesex press ltd, london NW4 4BT, ISBN:978-0-596-52722-0</titlepageverso>

<content>Chapter1,Chapter2,Chapter3</content>

</bookproject>



b. The following is the dtd file that validates the above xml code: -

<?xml version="1.0"?>

<!DOCTYPE bookproject[

<!ELEMENT bookproject(titlepage,author+,publisher,location,titlepageverso,content+)>



<!ELEMENT titlepage (#PCDATA)>

<!ELEMENT author (#PCDATA)>

<!ELEMENT publisher(#PCDATA)>

<!ELEMENT location (#PCDATA)>

<!ELEMENT titlepageverso(#PCDATA)>

<!ELEMENT content(#PCDATA)>

<!ELEMENT (#PCDATA)>

]>




Lecture Reflection-WEEK 6 – Name Spaces


In this week, we learnt about namespaces. Namespaces are used to remove the possibility of using the same element names for different purposes. Namespaces indicate the names the belong together and must have a unique name for the element. This is done by using a URI which looks like a web address by assigning it to a namespace element name. The element containing this URI now belongs to this the namespace and will not clash other namespaces.
I also learnt within the lecture that multiple namespaces can be used and had look at how namespaces are declared within a DTD.

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 05 – 28 October 09

Quick Questions

1. The code bellow is not a well-formed XML document, as it does not follow the certain XML rules. XML documents must contain a root element, start tag with closing tags, and the attribute value should be enclosed with quotation marks.

<:-/>


2. Well-formed XML documents means that the syntax used within the document is correct, however Valid XML is when XML is validated against a DTD.

3. It is always a good idea to use comments to start of an XML document, as comments are there to aid the reader as well as the programmer. Comments are used in virtually all programming languages, and are a useful tool in helping to understand the code.


Longer Question

1. Bellow is the XML file I have created which also contains the dtd within the document: -


<?xml version="1.0"?>

<!DOCTYPE textbook [

<!ELEMENT textbook (titlepage, title, author, publisher, titlepageverso, publisheraddress, copyrightnotice, isbn, chapter, chaptertitle,section)>

<!ELEMENT titlepage (#PCDATA)>

<!ELEMENT title (#PCDATA)>

<!ELEMENT author (#PCDATA)>

<!ELEMENT publisher (EMPTY)>

<!ELEMENT titlepageverso (#PCDATA)>

<!ELEMENT publisheraddress (EMPTY)>

<!ELEMENT copyrightnotice (#PCDATA)>

<!ELEMENT isbn (#PCDATA)>

<!ELEMENT chapter (#PCDATA)>

<!ELEMENT section (#PCDATA)>

<!ATTLIST sender publisher CDATA #FIXED " Excellent Books Ltd ">

<!ATTLIST sender publisheraddress CDATA #FIXED " Cemetry Lane, SE1 1AA, UK ">

]>

<textbook>

<titlepage>

<title>harry potter</title>

<author>j.k.rowling</author>

<publisher publisher= "Excellent Books Ltd" > </publisher>

</titlepage>

<titlepageverso>

<publishersaddress address="Cemetry Lane, SE1 1AA, UK"> </publishersaddress>

<copyrightnotice>blah rights limited</copyrightnotice>

<isbn>0293092309</isbn>

</titlepageverso>

<chapter>

<chaptertitle title= "beginning" number= "1">

<section title="first paragraph" number="1"></section>

</chaptertitle>

</chapter>

</textbook>



2. The following is an XML document that contains the following information: the name of a London tourist attraction. The name of the district it is in. The type of attraction it is (official building, art gallery, park etc). Whether it is in-doors or out-doors. The year it was built or founded. I chose appropriate tags. Used attributes for the type of attraction and in-doors or out-doors status.


<touristinfo>

<touristattraction>London Bridge</touristattraction>

<district>London</district>

<typeofattraction type=”famous bridge”></typeofattraction>

<premises status= “outdoor”></premises>

<yearitwasbuilt>1927</yearitwasbuilt>

</touristinfo>


Lecture Reflection-WEEK 5 – XML Encoding

During the 1960’s after the emergence of ASCII character set, the conventional computer software used it to represent text found in documents. It was the most widely used character encoding until 2008. ASCII character set used one byte to represent each character of the keyboard and was ideal for English and many European languages as well as having the ability to cope with simple mathematical expressions. However there are many other languages that contain different characters that need to be processed and stored that ASCII cannot process. The solution to this problem is the usage of “character set” such as UNICODE which covered almost every conceivable language. It has been published since 1991 and covers more than 107,000 characters in more than 90 scripts. Another alternative is the UCS character set which covers 4 billion characters when using all possible binary numbers.
Unicode was also designed so that the first 256 characters are identical to iso-8859-1 therefore allowing documents coded in ASCII easily usable with UNICODE.
When declaring the document type while leaving the character encoding section blank, the parser will automatically assume that the character encoding is UTF-8, however bellow is a few examples of how to specify different character sets in an xml declaration.

Encoding Declarations: -

1
<?xml version="1.0" encoding="UTF-16"?>

2
<?xml version="1.0" encoding="EUC-JP"?>
( Japanese character)
3
<?xml version="1.0" encoding="iso-8859-11"?>

( Thai character)

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

Tuesday, 30 March 2010

CMT3315 – Laboratory 04 – 21 October 09

Quick Questions

1. XML stands for Extensible Mark-up Language and CSS stands for Cascading Style Sheets

2. The line bellow is not well formed because the end tag
“</i>”
should be placed right before the
“</b>”
tag. The tags bellow have not been nested properly.

<b><i>This text is bold and italic</b></i>




3. The code bellow is not well formed, as there is no root element. There should be a root element, which contains all the other tags which does not apply in this case.

<?xml version= “1.0” ?>

<greeting>

Hello, world!

</greeting>

<greeting>

Hello Mars too!

</greeting>


Longer Questions

1. Bellow is an extract of an XML document containing details of the course that I am currently studying along with details of the time and of the room number in which I am currently in.

<subject start_time=”9” end_time=”12.30”>

<course_name>cmt3315</course_name>

<building_name>Hatchcroft</building_name>

<room_number>h101</room_number>

</subject>


2.
• There is an attribute value in the end tag of </price>. Attributes should be placed in the start tag.

• The “<price>” start tag does not match the “</Price>” end tag. Tags are case sensitive and therefore will need to  be the same.

• The <price> and <discount> tags are not nested properly. If a new tag is placed within a parent tag, then it must also be ended within the parent tag.

• The “<author”  start tag is missing a “>” and also contains a comment which is not allowed in xml. Comments cannot be placed within tags.

• Finally the root element “<bookstore>” does not have a closing tag


3.
<!DOCTYPE memo

[

<!ELEMENT memo (to,from,heading,body,date,securityClass)>

<!ELEMENT to (#PCDATA)>

<!ELEMENT from (#PCDATA)>

<!ELEMENT heading (#PCDATA)>

<!ELEMENT body (#PCDATA)>

<!ELEMENT date (#PCDATA)>





<!ATTLIST memo serialnumber ID DATA #REQUIRED>



]>


Lecture Reflection-WEEK 4 - Entities

During week 4, we were studying entities. Entity’s are declared at the top of the document has text assigned to it. This text can then be displayed anywhere in the document where the entity is used and as a result saves a lot of typing. Any single entity name can take the place of a batch of text. It is also very useful if there are certain bits of text within a document that needs to be changed regularly.

Bellow is an example of an entity declaration: -



<! ENTITY legalWaffle “not excluding rights of hudibras and persiflage heretoforeunder specified”>  ] >

The name “legalWaffle” from the above statement is assigned a piece of text. This piece of text is now viewable anywhere within the document where the name “&legalWaffle” appears.

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 03 – 14 October 09

Questions

1. The following XML document that contains the following information: my name, my email address, my student number, my home town, my date of birth. I have chosen appropriate tags and used attributes for the date of birth.


<?xml version="1.0"?>

<student DOB= “22/06/1987”>

     <name>Saif</name>

     <email>saif71@hotmail.com</email>

     <studentnumber>M00052834</studentnumber>

   <hometown>Barking</hometown>

</student>




2. An XML document was provided in class. From it,I have identified the following syntax errors bellow: -

&lt;?xml version= “1.0” ?&gt;

&lt;!DOCTYPE countryCollection SYSTEM "countryList.dtd"&gt;

&lt;CountryList&gt;

&lt;Nations TotalNations =”3”/&gt;

&lt;!--Data from CIA --Year Book --&gt;



<Country CountryCode=”1”>  this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.

<OfficialName>United States of America</officialName> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<Label>Common Names:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<CommonName>United States</commonName> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<CommonName>U.S.</commonName> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.




<Label>Capital:</capital> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error. Also this starts of with the closing tag for “capital” before the start tag, therefore the tag is not nested properly.

<Capital cityNum=”1”>Washington, D.C. </label>

<2ndCity cityNum=”2”>New York </2ndCity>

<Label>Major Cities:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.





<MajorCity cityNum=”3”>Los Angeles </majorCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<MajorCity cityNum=”4”>Chicago </majorCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<MajorCity cityNum=”5’>Dallas </majorCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error. The element inside has two different types of quotation marks which is also wrong.



<Label>Bordering Bodies of Water:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<BorderingBodyOfWater> Atlantic Ocean </borderingBodyOfWater> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<BorderingBodyOfWater> Pacific Ocean </borderingBodyOfWater> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.




<BorderingBodyOfWater> Gulf of Mexico </borderingBodyOfWater> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<Label>Bordering Countries:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<BorderingCountry CountryCode=”1”> Canada </borderingCountry> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<BorderingCountry CountryCode =”52”> Mexico </borderingCountry> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



</country>

<Country CountryCode=”81”>  this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<OfficialName> Japan </officialName> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<Label>Common Names:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<CommonName> Japan </commonName> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<Label>Capital:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<Capital>Tokyo</capital cityNum=”1”>  this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error. Also the attribute value is in the end tag which is incorrect as the attribute can only be placed inside the start tag.





<2ndCity cityNum=”2”>Osaka </2ndCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<Label>Major Cities:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<MajorCity cityNum=”3”>Nagoya </majorCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<MajorCity cityNum=”4”>Osaka </majorCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<MajorCity cityNum=”5’>Kobe </majorCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<Label>Bordering Bodies of Water:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<BorderingBodyOfWater>Sea of Japan </borderingBodyOfWater> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<BorderingBodyOfWater>Pacific Ocean </borderingBodyOfWater> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.





</country>

<Country CountryCode=”254”>  this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<OfficialName> Republic of Kenya </officialName> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<Label>Common Names:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<CommonName> Kenya </commonName> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<Label>Capital:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.




<Capital cityNum=’1’>Nairobi </capital> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<2ndCity cityNum=’2’>Mombasa</2ndCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.

<Label>Major Cities:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.

<MajorCity cityNum=’3’>Mombasa </majorCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.

<MajorCity cityNum=’4’>Lamu </majorCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<MajorCity cityNum=’5’>Malindi </majorCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.

<MajorCity cityNum=’6’ cityNum=’7’>Kisumu-Kericho </majorCity> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.

<Label>Bordering Bodies of Water:</label> this start tag is capitalised but the end tag does not start with a capital letter, therefore it is an error.



<BorderingBodyOfWater <!--Also Lake Victoria --> > Indian Ocean </borderingBodyOfWater>

</country>



Lecture Reflection-WEEK 3 - CSS

The lecture for the commencing week was easy and basic. The content of the lecture included Cascading Style Sheets (CSS) and The Extensible Style Sheets Language (XSL).
CSS is a style sheet used to style HTML. Style sheets can be external which allows multiple WebPages access to the CSS formatting or it can be internally scripted within the website it is intended to style. CSS can also be used to style XML however has limitations to its ability.
XSL on the other hand, is the style sheet used mainly for XML and is a much more powerful tool for styling then CSS. It allows the usage of XPATH which can be used to handle document components and therefore giving it some programming power. The basic concept is to use CSS with the simple styling and XSL for the more complicated style output.

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 02 – 7 October 09

Questions

1. The following list is the language used for each document, and is prioritized in the order the documents were displayed: -

1. HTML
2. XML
3. JAVASCRIPT
4. XML
5. DTD
6. XML
7. JAVASCRIPT

2. The distinctive characteristics of each document will be shown by displaying examples of syntax which are unique within the document language type.

• XML uses tags named by the programmer therefore the tags are NOT predefined as the following shows “John Smyth
• XML is used to store and transport data where as HTML is used to display data to a certain degree
• XML tags always has a start and an end tag containing the information in between

3. If all the documents became one language known as XML then applications such as Microsoft word and note pad could use these documents as well as the obvious application such as internet explorer

Lecture Reflection-WEEK 2 - XML


During this week we studied XML. XML stands for eXtensible Markup Language and is similar to html except it is a more cleaner as the tags within XML must be nested properly. XML is the basis for XHTML which stands for Extensible Hyper Text Markup Language. It is almost identical to HTML 4.02 except XHTML is a stricter and cleaner version of HTML.
XML is a meta markup language, meaning that it allows you to make up the tags as opposed to html, which only allows predefined tags. Another good aspect of XML due to its simplicity in design, is that it is readable by nearly all people and applications.
We also covered “XIML “which is an XML –based interface representation language. We also covered “XUL” which is Mozilla’s XML-based user interface language.

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

CMT3315 – Laboratory 01 – 30 September 09

Questions

1. The first browser to read and support XML was Microsoft IE4

2. CSS stands for Cascading Style Sheets and is a style sheet language used to describe the formatting and looks of HTML or any other document written in a mark up language. Normally it is used for designing web pages written in HTML or XHTML, however it can be applied to XML documents as well.

3. XSL stands for Extensible Stylesheet Language and is used to refer to a group of language which are used for transforming XML documents.

XSL is split into three parts which are: -

1. XSL Transformation
2. XSL Formatting Objects
3. XPath

XSL Transformation is also known as XSLT and is the most important part of XSL. XSLT became a W3C Recommendation 16. November 1999.
It is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML. It uses XPath to find information in an XML document by navigating through the elements and attributes of an XML document.

4. CSS and XSL are both style sheets, but their used for different purposes. This is because with CSS it is possible to define the styles of each element of HTML and XML which allows control over the colours, fonts, positioning, and background. CSS has is its limitation though; which is why XSL is used to do extra formatting work that CSS can’t do.
XSL is used to structure documents whereby having the ability to control the order of the elements, calculations and addition of content. XSL is a much more powerful language and is used mainly for XML documents allowing the ability to change the elements to be displayed in the order of the programmer’s choice. Along with the fact that you can also replace words and convert XML to XHTML, it is clear to see that XSL offers more variety BUT is also a harder language to implement then CSS. The basic idea is to “use CSS when you can but use XSL when you must” Bos (1999). This clearly makes sense as CSS is easier to implement and can do the simple things very well such as changing HTML element and background colour but if you needed to do more complicated stuff, such as re-arranging the elements then it can be done so with XSL.

5. The relational structure of the HTML/XHTML documents forms a Document Tree. Elements inside an HTML/XHTML document are linked together using the tree relationship. This is used to properly implement CSS selectors, and other functions related to DOM such as JavaScript methods and functions.

Lecture Reflection-WEEK 1 – Understanding

In the first lecture the tutor gave a brief introduction on the concepts of web documents and web technologies, in which the example of Edwin Smith Papyrus was used. The example consists of an ancient document about medicine which has a strong structure and can be organised and presented as an instructional package. Web technologies and this concept are similar in which they are used to present information on the web.

A concise look at the mark-up languages history were looked into in which a set of symbols were used in order to communicate with typesetters, which was developed by Charles Goldfarb, Edward Mosher and Raymond Lorie in the 1060’s. Eventually the thinking of word processing was thought of in order of storing documents onto computers. This concept was the foundation HTML and XML were built upon.

http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main