Monday, January 24, 2011

Ruby On Rails

Today I downloaded and installed Ruby On Rails. I also installed plugin for NetBeans but still not working properly. Read some tutorials and tried some simple code like creating classes with methods and variables etc. Found a good user guide for syntax on http://www.ruby-doc.org/docs/UsersGuide/rg/. Will read and try a few examples...

Saturday, January 22, 2011

Second - Fifth Tasks


9) XIML Stands for c) Extensible Interface Markup Language. This allows some control on UI within data interchange.  It is a Universal Language for User Interface and a Common Representation for Interaction Data.

10) XIML is a) a Universal Language for User Interface. It is a common way of representing data. It supports design, operation, organization, and evaluation functions and  is able to relate the abstract and concrete data elements of an interface. It enables knowledge-based systems to exploit the captured data.

11) XUL is b) XML User Interface Language. It is an application of XML used to describe the Window layout in the Mozilla browser. It provides a simple and portable definition of common GUI interfaces.

12) XSL is d) a stylesheet language (XML Stylesheet Language). XSL includes an XML vocabulary for specifying formatting. XSL specifies the styling of an XML document by using XSLT to describe how the document is transformed into another XML document that uses this formatting defenition.


13) The last line should be b) </note>. This is because there must always be a closing tag for the <note> opening tag.

14) The missing line is d) </caption>. This is because we need to close the opening tag <caption>.


Third Task:
1)      XML Well-formedness refers to correct syntax and rules like opening tags must have corresponding closing tags and must not be nested before closing etc.
2)      XML validation refers to XML being conformant to a validation document such as a DTD or (XSD?). That is it must be well formed and must obey the restrictions and definitions in the DTD.
3)      We can use XSLT or CSS files to change the presentation of XML documents
4)      The first line of an xml document contains the version and so it is quite important
5)      Elements are containers of data or other elements while attributes describe particular elements.
6)      AJAX (Asynchronous JavaScript And XML ) is a technology that allows a client to make asynchronous requests to a server and be able to handle the reply without holding the client from continuing with its normal execution.

Fourth Task:
1)      The current status of CSS is “completed work”
2)      The current status of XSL is “completed work”
3)      CSS is used to style HTML, XML & XHTML. It is NOT an XML document and is simple to use. XSL is an XML doc and it is more complex and precise. XSL was then used to transform XML using XSL/T.
4)      The Document Tree is the relational structure of the HTML/XHTML document. All HTML documents are trees.

Fifth Task:
15)
 <? Xml version=”1.0” ?>
<students>
                <student studentID=”M00643547647”>
                                 <name>Tony</name>
                                …
                </student>
</students>

Monday, January 17, 2011

Second Task (Q5 to Q8)

Continued from Week9 (2)
5) The relationship between SGML and HTML is “HTML is a mark-up language derived from SGML” (a). HTML is a small subset of SGML used mainly to define how information is displayed.
6) c is true i.e. “Special-purpose mark-up languages have been derived from XML". Example when a system uses a custom built communication and display protocol or markup for its own internal use.
7) b is NOT true – “XML is a predecessor of SGML”. This is false since SGML was published in 1986 and XML was developed in 1996.
8) d is NOT true – “XML is written in Java”. This is false since XML as such is made from ordinary text and can be written with any modern text editor including notepad.

Friday, January 14, 2011

Week10 (3)

CMT3315  –  Laboratory 12 
Quick questions:

  1. The following passage is to be found in the middle of a particular XML document:
The heavily-used<service xlink:type = "simple" xlink:href ="http://www.thetrams.co.uk/croydon"
> Croydon Tramlink </service> provides a cross link to nearby <location>Wimbledon</location>, <location>Addington</location> and <location>Beckenham</location>.
What can you say about how the text Croydon Tramlink will be treated by a browser such  as Mozilla Firefox?

The text Croydon Tramlink will become a hyperlink to http://www.thetrams.co.uk/croydon


  1. It’s possible to provide validation for a class of XML document using a Document Type Definition (.dtd) file, or using an XML schema. The DTD approach is easier. Why might you want to use the XML schema approach?

The XSD approach has better type validation and more control on output like sorting etc.
·         XSD is extensible. You can derive new elements from the existing elements. DTD is not.
·         XSD is defined in XML. It does not require intermediate processing by a parser. DTD is not defined in XML. You need separate parsers for DTD and XML.
·         XSD supports data types. You can restrict the content of an element. DTD does not support data types. Therefore, you cannot restrict the content of an element.
·         XSD supports default values. You can specify default values of the elements. You cannot specify the default values of elements in DTD.
·         XSD supports references to external XML schemas. You can include or import more than one XML schema within an XML schema. You cannot include other DTDs within a DTD.
  • Key mechanism that is directly analogous to relational database foreign keys
  • XML schemas provide better support for modularity and reuse with include and import elements.
  • XML schemas support inheritance for element, attribute, and data type definitions.

Longer question:
Notes on schema of XML doc shown:
 

1)      Book has numeric “isbn” attribute
2)      Every book has 1 title, 1 author and 1 or more character sections
3)      Every character section has;
A name element (string type)
An Optional friend-of element (string type)
A “since” element (date type)
A “qualification” element (string type)




Friday, January 7, 2011

Week10 (2)

CMT3315  –  Laboratory 11 

Quick questions:

1) Advantages of having the definition of a particular hyperlink in a third document (i.e. not in source or destination)
It is easier to maintain say by having a list of hyperlink definitions in one place i.e. like a lookup or link table.
The source and destination documents can be kept safe and no need to modify these to change a link.

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” - Link replaces current document (replace this page)
show="new" - Open link in a new window (a new separate window)
show=”embed” - Open link inside this page (or in line) (where link is)
Which of these three attribute values is the default? - show=”replace”


Longer Questions:
1a)        Amend the document, so that the link is in fact there. Make any necessary changes to the .dtd file as well.
XML:
<message>I think we should be making wind-turbines. Have a look at <![CDATA[<a href=' http://engineering.suite101.com/article.cfm/wind_power'>this website</a>]]>. Tell me what you think. </message>
DTD:
<!ELEMENT message (#CDATA)>

1b) name link in url. 
<a href=' http://engineering.suite101.com/article.cfm/wind_power# WE Elec Facts '>text</a>
2) ural for making solar panels
XML:
<message>I think we should be making solar-panels. Have a look at <![CDATA[<a href=' http://www.make-solar-panels.org/'>this website</a>]]>. Tell me what you think. </message>
DTD:
No changes needed













Wednesday, January 5, 2011

Week10

This week we where given the details for CW2 of CMT3315. We then went through a tutorial on XML syntax. We saw the advantages of using XML Schema Definition (XSD) over Document Type Definition (DTD) to validate and even control the way an XML document is displayed. XSD can define strict data types and even the sort order of an XML file.

We saw the difference between simple and complex types i.e. those that are text only and without any attributes or any other child types are simple. Anything NOT simple is complex.

Restricion on values:
We use <xs:restriction with a set of <xs:enumeration to define a list of possible values for a particular element.
Or use a <xs:patern value = "male/female" />
Or for a number between 1 & 100 inclusive
 <xs:minInclusive value="1"/>
 <xs:maxInclusive value="100"/>
or       <xs:pattern value="[a-z]"/> or ="[0-9]"/>
or a password of 8 mixed characters  <xs:pattern value="[a-zA-Z0-9]{8}"/>

Some Simple Types:  xs:string, xs:decimal, xs:integer, xs:boolean, xs:date, xs:time, xs:dateTime