This topic provided an introduction to the the structure, use and workings of XML. Ince (2004) provides a definition, stating that XML is not a markup language like HTML, but is a language used to describe the markup language. I found this exercise to be somewhat challenging, no doubt due to my limited programming background. Thankfully chapter 8 of Ince (2004) has a very detailed coverage of XML with p219 specifically talking about document type definition (DTD) and providing an example of a simple DTD. The DTD is the first thing that is required when developing an XML application as it defines the structure of the language that is to be processed, what the elements are, what tags are associated with the elements and what attributes can be associated with an element and the text which identifies a tag.
Using the sample provided in Ince (2004) I managed to create the following DTD for an online car catalogue which has the child elements of make, model, year, colour, engine , number_of_doors, transmission_type and accessories, with the engine having child elements called number_of_cylinders and fuel_system. This may be viewed at the following link.
Further reading of Ince (2004) on pages 228 and 229 reveals further examples of a DTD, in this particular case, for an online booklist. Interestingly, this example not only provides an example DTD, but also some source which is defined by the DTD. If I'm understanding correctly, drafting some source which is define by the above DTD is relatively straightforward. Below is my attempt at writing some source for the above DTD, cataloguing my beloved Mini Cooper S.
There is also an example of a program to process this source in Ince (2004) on p229, however this is well and truly beyond me, and the scope of this question.
No comments:
Post a Comment