BEGINNING XML PART 6 – PARSING XML

The main reason for creating all of these rules about writing well-formed XML documents is so that we can create a computer program to read in the data, and easily tell markup from information. According to the XML specification (http://www.w3.org/TR/1998/REC-xml-19980210#sec-intro): “A software module called an XML processor is used to read XML documents and provide …

Continue reading →

BEGINNING XML PART 5 – PROCESSING INSTRUCTIONS (Page 1)

These allow you to enter instructions into your XML which are not part of the actual document, but which are passed up to the application. <?xml version=’1.0′ encoding=’UTF-16′ standalone=’yes’?> <name nickname=’Shiny John’> <first>John</first> <!–John lost his middle name in a fire–> <middle/> <?nameprocessor SELECT * FROM blah?> <last>Doe</last> </name> There aren’t really a lot of …

Continue reading →

BEGINNING XML PART 5 – PROCESSING INSTRUCTIONS

These allow you to enter instructions into your XML which are not part of the actual document, but which are passed up to the application. <?xml version=’1.0′ encoding=’UTF-16′ standalone=’yes’?> <name nickname=’Shiny John’> <first>John</first> <!–John lost his middle name in a fire–> <middle/> <?nameprocessor SELECT * FROM blah?> <last>Doe</last> </name> There aren’t really a lot of …

Continue reading →

BEGINNING XML PART 4 – EMPTY ELEMENTS AND XML DECLARATION

Sometimes an element has no data. Recall our earlier example, where the middle element contained no name: <name nickname=’Shiny John’> <first>John</first> <!–John lost his middle name in a fire–> <middle></middle> <last>Doe</last> </name> In this case, you also have the option of writing this element using the special empty element syntax: <middle/> This is the one …

Continue reading →

BEGINNING XML PART 4 – EMPTY ELEMENTS AND XML DECLARATION (Page 1)

Sometimes an element has no data. Recall our earlier example, where the middle element contained no name: <name nickname=’Shiny John’> <first>John</first> <!–John lost his middle name in a fire–> <middle></middle> <last>Doe</last> </name> In this case, you also have the option of writing this element using the special empty element syntax: <middle/> This is the one …

Continue reading →

BEGINNING XML PART 3 – COMMENTS

Anyone who has used a programming language will be familiar with the idea of comments: you want to be able to annotate your code (or your XML), so that those coming after you will be able to figure out what you were doing. (And remember: the one who comes after you may be you! Code …

Continue reading →

BEGINNING XML PART 2 – ATTRIBUTES (Page 2)

How It Works Using attributes, we added some information about the CD’s serial number and length to our document: <CD serial=B6B41B disc-length=’36:55′> When the XML parser got to the “=” character after the serial attribute, it expected an opening quotation mark, but instead it found a B. This is an error, and it caused the …

Continue reading →

BEGINNING XML PART 2 – ATTRIBUTES (Page 1)

Attributes are simple name/value pairs associated with an element. They are attached to the start-tag, as shown below, but not to the end-tag: <name nickname=’Shiny John’> <first>John</first> <middle>Fitzgerald Johansen</middle> <last>Doe</last> </name> Attributes must have values – even if that value is just an empty string (like “”) – and those values must be in quotes. …

Continue reading →

BEGINNING XML PART 2 – ATTRIBUTES

Attributes are simple name/value pairs associated with an element. They are attached to the start-tag, as shown below, but not to the end-tag: <name nickname=’Shiny John’> <first>John</first> <middle>Fitzgerald Johansen</middle> <last>Doe</last> </name> Attributes must have values – even if that value is just an empty string (like “”) – and those values must be in quotes. …

Continue reading →