Question 1
Have a look at the documents below. Some are XML documents, some are HTML documents, some may be neither. See if you can decide which are which.
Document 1
Document 1 is an HTML file document however it is not correctly structured. There are certain tags which don't have a closing tag. Open table tags are not properly closed. If it was arranged with proper HTML tags than it could be an HTML but only after amendments have been made.
The document starts with a tag called <head> and is followed with a <body> tag, hence it gives the look of an HTML document. There is also the use of metdata which is used by search engines
No closing tag |
Document 2 is an XML document as it is not showing any layouts. The reason for this is that it has a <DOCTYPE> which is declaration that it is XML pointing to a DTD. It has a root node, which is <advertisment> and other child and subchild elements which give detail about advertising information. This also contains an XSL document which means that data might contain some formatting.
Document 3
This document is an HTML document where it is outputting a form, containing a drop down selection menu and a button. This document also contains some script which is declared as Javascript.
Showing a basic forn in HMTL |
Document four is another XML document with its root element being story. This means that the XML will desribe what a story is made out of. Several child elements like <title><author><section> and others. The first line of code is a declaration pointing to a DTD file. Difference between this and the 2nd document is that this will show raw data with no formatting as it does not contain any XSL.
Document 5
The fifth document consists of both HTML and XML, however there are some errors which conclude into being neither an HTML document nor an XML document.
Document 6
This is another XML document <countrylist> is the root element <country> is a child and contains a lot of subchilds like <officename>, <label>, <commoname> and others. This document looks like a valid XML document.
Document 7
The last document is an HTML document containing Javascript.
Question 2
Make a list of the distinctive characteristics of an XML document, in terms of things that you can spot when looking at the code.
Answer
- Each XML document would have an XML decleration
- An XML document would contain only one root element
- It also contains number of user specified tags
- All opening tags should be closed
- XML attributes must be within quotes
Question3
Assume that (with suitable changes) all these documents could become XML documents. Imagine, and describe, applications that could use these documents.
Answer
All the above documents can be used for several different things. HTML documents are used to display information. XML docments are used to exchange information a good example of this is document two. Document three, which consists of an uploading form can be used for several different reasons in this case there is a list of countries and players being uploaded which can be used to state which country that player comes from. Document four is about a book or a story, this may allow users to be shown any information regarding that book. Document 6 is one which can be used by travel agents for example since it gives out a lot of country information.
No comments:
Post a Comment