Home arrow XML arrow Page 5 - XML Basics (part 1)

Lights, Camera, Action! - XML

Struggling with XML? Can't figure out the difference between an entity and a namespace? Fear not - our XML series has all the answers. This introductory article discusses the origins and design goals of XML, the basic rules of XML markup, and how to use elements and attributes in an XML document.

TABLE OF CONTENTS:
  1. XML Basics (part 1)
  2. A Little History
  3. The Big Picture
  4. The Hammer And The Chisel
  5. Lights, Camera, Action!
  6. Breaking It Down
  7. Simply Element-ary
  8. Anyone For Chicken?
  9. To Attribute Or Not To Attribute...
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 4
July 23, 2001

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
OK, enough with the background - let's get our hands dirty. Consider the following XML document:

<?xml version="1.0"?> <review> <genre>Action</genre> <title>X-Men</title> <cast> <person>Hugh Jackman</person> <person>Patrick Stewart</person> <person>Ian McKellen</person> <person>Famke Janssen</person> </cast> <director>Bryan Singer</director> <duration>104</duration> <year>2000</year> <body>Every once in a while, Hollywood takes a comic-book hero, shoots him on celluloid, slaps in a few whiz-bang special effects and stands back to see the reaction. Sometimes the results are memorable (<title>Superman</title>, <title>Spiderman</title>, <title>Flash Gordon</title>) and sometimes disastrous (<title>Spawn</title>, <title>The Avengers</title>). Luckily, <title>X-Men</title> falls into the former category - it's a clever, well-directed film that should please both comic-book aficionados and their less well-read cousins.</body> <rating>4</rating> </review>
As you can see, an XML document, like an HTML document, is simply an ASCII text file. This specific text file contains a recipe, broken up into different sections; each section is further "marked up" with descriptive tags to precisely identify the type of data contained within it.

An XML document may be either "well-formed" or "valid".

A well-formed document is one which meets the specifications laid down in the XML recommendation - that it, it follows the rules for element and attribute names, contains all essential declarations, and has properly-nested elements.

A valid document is one which, in addition to being well-formed, adheres to the rules laid out in a document type definition (DTD) or XML Schema. By imposing some structure on an XML document, a DTD makes it possible for documents to conform to some standard rules, and for applications to avoid nasty surprises in the form of incompatible or invalid data.

DTDs are essential when managing a large number of XML documents, as they immediately make it possible to apply a standard set of rules to different documents and thereby demand conformance to a common standard. However, for smaller, simpler documents, a DTD can often be overkill, adding substantially to download and processing time.

This article copyright Melonfire 2001. All rights reserved.

 
 
>>> More XML Articles          >>> More By icarus, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

XML ARTICLES

- Google Docs and Xpath Data Functions
- Flex Array Collection Sort and Filtering
- The Flex Tree Control
- Flex List Controls
- Working with Flex and Datagrids
- How to Set Up Podcasting and Vodcasting
- Creating an RSS Reader Application
- Building an RSS File
- An Introduction to XUL Part 6
- An Introduction to XUL Part 5
- An Introduction to XUL Part 4
- An Introduction to XUL Part 3
- An Introduction to XUL Part 2
- An Introduction to XUL Part 1
- XML Matters: Practical XML Data Design and M...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: