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

Simply Element-ary - 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
The document prolog is followed by a series of "elements". An element, which is the basic unit of XML, consists of textual content (or "character data"), enhanced with descriptive tags (or "markup"). The boundaries of an element are defined by start and end tags, and may contain additional descriptive "attributes".

Here are some examples of XML elements:

<title>XML Basics</title> <item>Nutcracker</item> <dinosaur>Stegosaurus</dinosaur>
XML also allows for so-called empty elements - essentially, elements which have no content and therefore do not require a closing tag. Such elements are closed by adding a slash (/) to the end of their opening tag. For example,

<rule>Every sentence ends with a <period /></rule>
An element name must begin with a letter, optionally followed by more letters and numbers. For example,

<popeye> <book> <INCOME>
are all valid element names.

Element names are case sensitive - so

<me>
is different from

<Me>
or

<ME>
An element may contain only text,

<step>Garnish with lemon and chopped onions</step>
or a combination of text and other elements.

<sentence>The red <animal>wolf</animal> jumped over the blue <vegetable>aubergine</vegetable></sentence>
In order to be well-formed, an XML document must contain at least one non-empty element. This outermost element is called the "root element" and, in turn, may contain other elements, nested in a hierarchical manner. In the first example above, the root element would be <review>...</review>.

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: