Welcome

To my corner on the net... Warning, this is a techie blog! Non-techie people may suffer bouts of epilepsy on viewing this blog. The author cannot be held responsible.

XML

Thursday, 17 March 2011

Introduction
This week we tackled XML.  I had used XML loosely in my work but never really delved much into understanding it. I had previously had to modify XML files for use in third party applications and I understood from previous experience during my diploma and advanced diploma work that XML files were designed to contain data in a standardised form. I had not yet grasped the idea that XML tags are really not XML tags at  all but rather just tags that you can invent at will and that you simply had to follow some rules for the XML file to be valid. If one keeps in mind that HTML is used to display data while XML is used to describe the data and focus on what the data is, the difference between the two is then very clear.


Creating and validating the XML File
The following XML file was created using a standard text editor and then validated using the validator  at W3 Schools. A simple Google search also revealed that there are many other examples of validators on-line. Another good example is the one at www.xmlvalidation.com


<?xml version="1.0"?>
<project name="John Gatt" id="223344">
    <title>Mastering XML</title>
    <category>BSC Projects</category>
    <abstract>This is the abstract</abstract>
    <date>12/12/2000</date>
</project>


The image above shows the validation results for the test XML file created. I then decided that perhaps it would be better to not use attributes in this case. I therefore changed the file as follows :


To create the DTD I chose to use an external DTD rather than one which is included within the XML document itself and the next image shows the line added to reference the external schema:



To be continued....






0 comments:

Post a Comment