by Richard G. Baldwin
baldwin@austin.cc.tx.us
Baldwin's Home Page
Dateline: 12/03/99
The first article in the series provided the following brief definition of XML:
XML gives us a way to create and maintain structured documents in plain text that can be rendered in a variety of different ways.Then the article proceeded to break down the jargon into plain English and provided some examples of structured documents.
In the previous article in this series, I introduced you to tags, elements, content, and attributes. I discussed tags and attributes in some detail, and promised to take up elements and content in this article.
<chapter number="1">
Content for Chapter 1
</chapter>
In this case, the optional attribute is colored blue and the content is colored green for clarity.
Elements can be nested inside other elements as shown below:
<book>
<chapter number="1">
Content for Chapter 1
</chapter>
<chapter number="2">
Content for Chapter 2
</chapter>
</book>
In this case, two chapter elements are nested inside a book element. For clarity, the tags surrounding the book element are shown in blue while the tags that surround the chapter elements are shown in green.
Sandwiched in between the beginning tag and the end tag of an element, we find the raw information (content) that the XML document is designed to convey.
That article (and several subsequent articles) concentrates on how to write computer programs (using the Java language) that decompose an XML document into its elements for some useful purpose. I report that SAX is an event-based approach to XML document processing.
An event-based approach reports parsing events (such as the start and end of elements) to the program using callbacks. The program implements and registers event handlers for the different events. Code in the event handlers is designed to achieve the objective of the program.
Coming attractions... |
As mentioned above, in my next article I will take up the subject of content. Tune in then for more exciting information about XML.
Trying to wrap your brain around XML is sort of like trying to put an octopus in a bottle. Every time you think you have it under control, a new tentacle shows up. XML has many tentacles, reaching out in all directions. But, that's what makes it fun. As your XML host, I will do my best to lead you to the information that you need to keep the XML octopus under control. Credits This HTML page was partially produced using the WYSIWYG features of Microsoft Word 97. The images on this page were used with permission from the Microsoft Word 97 Clipart Gallery.
041121
Copyright 2000, Richard G. Baldwin
baldwin@austin.cc.tx.us
Baldwin's Home Page
-end-