Web Computing Revision Notes
Exam Format The format of the exam is standard: Answer TWO OUT OF THREE questions Candidates should answer ONLY TWO questions The time allowed is TWO hours Notes: You will not be expected to write large quantities of code in the exam, and the exact syntax is not essential to get full marks for any small programs.
Hints and tips Everything that we covered in the course may be in the exam. Write something for every question: I cannot give marks for a blank page, but I might be able to give partial marks for an attempt at a question. Use the time well: plan which questions you will answer, and spend some time at the end checking that you did indeed answer all the parts as fully as you can. Avoid writing essays: use bullet points, one for each point that you want to make when you want to write a lot. This usually means that you write less, and also makes it easier to mark.
How to revise: XML What is XML? Commit a small example to memory Practice defining XML for some data Relation to related systems: e.g. HTML Use of tags vs. attributes? Advantages of each, when should each be used? Be able to transform XML with attributes to XML without attributes, and vice-versa Namespaces: purpose and ability to put into use Verifying structure: DTD and schemas Generally: always try to illustrate your answer with a concrete examples.
Question 1 Design an XML language for representing simple messages (notes, like post-it notes). These should contain who it to for, who it is from, the title of the note, and the message of the note. List the tags that you would use, indicating any attributes that you would need. <note> <to>alice</to> <from>bob</from> <heading>shopping</heading> <body>don t forget to do the shopping!</body> </note>
Question 2 Outline two different technologies for verifying the structure of an XML document. Illustrate your answer with the XML from the previous question. DTD: <?xml version="1.0"?> <!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]>
Question 2 Schemas: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" targetnamespace="http://www.somesite.com" xmlns="http://www.somesite.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>
Question 2 DTDs have a number of limitations when it comes to document validation DTDs cannot fully constrain the type of data in an element DTDs are too restrictive with respect to the order in which elements are presented. For example, the element declaration <!ELEMENT date (day, month, year)> would make the DTD reject any document whose date element is not given in the order day, month and year in addition, DTDs have a somewhat different syntax to plain XML
Question 3 XML can be transformed in a number of different ways: state them and state if they are Server-side or Client-side transformations? XSLT DOM JavaScript Ability to put XSLT into practice (again, commit a small example to memory)
Question 4 1 Briefly outline the main features of the HTTP protocol. Include in your answer the main status codes. 2 Describe the differences between the methods GET and POST. As part of your answer, explain one way in which parameters can be passed from a client application to a HTTP server. see Lecture 8 3 Briefly describe one way in which the HTTP protocol can overcome the fact that it is a stateless protocol. Cookies 4 Explain how Apache Tomcat will serve a JSP page.
Question 5 It is proposed to use XML to represent addresses of people (name, address) and addresses of servers (name, address). Explain how you could do this with one XML language with namespaces.
Question 5 <?xml version="1.0"?> <department xmlns="http://somesite/addresses" xmlns:ip="http://somesite/internet"> <name>mr Smith</name> <address> <street>the Strand</street> <city>london</city> <country>uk</country> </address> <ip:server> <ip:name>informatics web</ip:name> <ip:address>195.238.237.142</ip:address> </ip:server> </department>
Question 6 An application was developed with HTML forms to allow the addresses from the previous question to be entered. Explain how fields can be validated. Your answer should state how the validation is done, which technologies are used, and whether it is server or client who does the validation. Demonstrate by giving the validation of IP addresses.
Question 7 Explain what DOM is, and show how it can be used both by the client and the server. Document Object Model,... Java API (server side) JavaScript (client side)
Topics Don t forget: any part of the course might be in the exam. XML (ordered labelled tree), HTML CSS: selectors, some properties (e.g. different ways to represent colours, etc.) DTD and Schemas DOM, XSLT JavaScript: regular expressions, DOM AJAX HTTP, cookies (also JSON, localstorage, etc.) Sevlets and JSP Comparison and appreciation of technologies Good Luck!