Advanced Web Topics
Saturday 17 December 2011
What is AJAX and what are its purposes?
Labels:
Third task
What is the importance of the first line of an XML document?
When starting an XML document, the first line must contain an XML declaration that indicates the version of XML used in the document. To write a valid XML document, a document type definition (DTD) before the first element in the document must be associated. An example of XML document that would be validated:
<?xml version="1.0"?>
<!DOCTYPE greetingxml SYSTEM "greeting.dtd">
<body>
<greeting>Hello World!</greeting>
</body>
The first line defines the version of XML being used. If an XML document does not conform to the version specified then this document has an error hence will not be processed by the intended application.
Second line indicates the name of the DTD "greeting" and identifies the URL of the DTD as "greeting.dtd" which is found in the same directory as the XML document. This line must be needed if someone wants the XML document be validated against an intended DTD.
<?xml version="1.0"?>
<!DOCTYPE greetingxml SYSTEM "greeting.dtd">
<body>
<greeting>Hello World!</greeting>
</body>
The first line defines the version of XML being used. If an XML document does not conform to the version specified then this document has an error hence will not be processed by the intended application.
Second line indicates the name of the DTD "greeting" and identifies the URL of the DTD as "greeting.dtd" which is found in the same directory as the XML document. This line must be needed if someone wants the XML document be validated against an intended DTD.
Labels:
Third task
How can an XML document be best presented?
XML itself does not specify lay-out of a document. It is just used to represent the data and structure them. Therefore XML does not present well. Hence a stylesheet is needed which attaches lay-out instructions to elements. There are two stylesheet languanges: Cascading Style Sheets (CSS) and eXtensible Style Language (XSL).
CSS pre-dates XML which is used for HTML, in fact developed alongside HTML. It supports enhanced presentation and easier editing.
h1{font-family:helvetica;font-size:16pt};
p{font-style:italic};
It is not formulated in XML so there is not much direct support for XML yet. However, all major browser directly displays XML + CSS, to some extent.
XSL is an XML application and in fact combination of three standards:
- XSLT Transformation language
- Xpath - used to identify parts of an XML document
- XSL-FO - Formatting language
We can use either CSS or XSL with our XML document to be best presented.
Labels:
Third task
What is XML validation and what is the output?
According to W3C , a valid XML document is a well formed XML document, which also valid in that it conforms to the rules of a Document Type Definition (DTD). A well formed document follows the basic syntactic rules of XML, which are the same for all XML documents. A valid document respects the rules dictated by a particular DTD or XML schema according to the application specific choices. So basically a valid XML document must:
<?xml version="1.0" ?>
<!DOCTYPE note SYSTEM "Note.dtd">
<note>
<to>Tove</to>
<from>Jani</Ffrom>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
The DOCTYPE declaration in the example above, is a reference to an external DTD file.
Due to the W3C XML specification, a program should stop processing an XML document if it finds an error but allows for some flexibility in regarding the validation. The output of an XML validator depends on the implementation. It would most likely consist of a list of errors encountered.
To help you check the syntax of XML files, W3C has created an XML validator to syntax-check XML.
- be well formed
- have a DOCTYPE declaration
- comply with a defined logical structure indicated by the DTD that the DOCTYPE declaration says that it is
For example:
<?xml version="1.0" ?>
<!DOCTYPE note SYSTEM "Note.dtd">
<note>
<to>Tove</to>
<from>Jani</Ffrom>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
The DOCTYPE declaration in the example above, is a reference to an external DTD file.
Due to the W3C XML specification, a program should stop processing an XML document if it finds an error but allows for some flexibility in regarding the validation. The output of an XML validator depends on the implementation. It would most likely consist of a list of errors encountered.
To help you check the syntax of XML files, W3C has created an XML validator to syntax-check XML.
Labels:
Third task
What is XML well-formedness and how could you measure it?
XML well-formedness means that a document follows proper XML syntax. If not, the XML parser will spot lapses in the syntax of an XML document, stop processing the document and report them. So only well-formed documents are passed on to the application.
Errors in XML documents will stop XML applications. The W3C XML specification states that a program should stop processing an XML document if it finds an error. The reason is that XML software should be small, fast, and compatible.With XML, errors are not allowed. To help syntax-check XML, W3C has created an XML validator.
A well formed XML documents must satisfy a list of syntax rules. Key points of syntax rules are:
- XML documents must have at least one element
- XML documents must have a root element which has a unique opening and closing tag that contains all other elements
<root>
<child>
<subchild>.....</subchild>
</child>
</root> - All elements must have a closing tag and they must be properly nested.
<b><i>This text is bold and italic</i></b> - XML is case sensitive
These are all legal names but they are all different names: chapter, Chapter, CHAPTER, ChApTer, chapteR - All attribute values must be quoted
<file type="gif">computer.gif</file> - All names used must be well formed
The first character must be a letter A-Z or a-z or a colon or an underscore. Numbers can not be used. A name can not be started with the group of 3 letters xml or XML or Xml etc.Other characters in the name can be those already mentioned, plus numbers 0-9, hyphens and fullstops.
Labels:
Third task
Saturday 12 November 2011
First | Blog
Hi, this is Adnan Faradhi, a final year student at middlesex university. I am studying computer science. I created this blog as part of my course work for the module Advanced Web Topics and XML. We are going to study the latest technologies that have been invented in the world of web development. Throughout the course, we are going to practice the module topics. Based on those topics, I will publish a series of posts which will allow me to get knowledge in depth as well as give you an overview of the technologies that we have in place. Please follow my blog and post comments so we can discuss the topics and if any questions to arise, I will give answers with explanation. Thanks.
Subscribe to:
Posts (Atom)