Sunday, 13 March 2011

Week 4 - XML

XML
XML stands for eXtensible Markup Language. It is a language used to describe other languages and was designed to carry data and not to display data.  In XML the syntax is strict.
The following are the Key Components of XML:
Elements
  • Elements must have a closing tag
  • Tags are case sensitive
  • Elements must be nested correctly
  • XML documents must have a root element
  • Example: <studname> Stephanie </studname>
Attributes
  • Can be added to elements in XML
  • Must always be quoted
  • Example: <student dob="30/04/89"></student> 
An XML file was created to keep the following data about a student project: student name, student ID, project title, project category, abstract, date submitted.  The XML have also been validated using the W3Schools XML Validator.

Without a root element and without quoted attributes:

With the right syntax:

DTDs
DTDs stands for Document Type Definitions and defines the legal building blocks of an XML document.  A DTD describes an XML document in terms of elements, tags, attributes, entities, PCDATA (parsed character data) and CDATA.  CDATA is similar to a comment that will not be processed.  A DTD have been created and also validated using W3Schools DTD Validator, that will validate the XML against a DTD.  Only Internet Explorer will check the XML against the DTD.

Missing attributes id and name (since #REQUIRED is included):
 Without errors:
Schemas
A schema is used to describe the structure of an XML document.  The following is an example of a schema.

No comments:

Post a Comment