O'Reilly logo

Discovering SQL: A Hands-On Guide for Beginners by Alex Kriegel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A BRIEF INTRODUCTION TO XML

A well-formed XML document has a tree structure, or forest structure, for more complex composite documents. At the branches (or nodes, which is the technical term) of the tree are usually elements (although there also can be attributes, comments, and such), and there must be a single root element. An element is anything enclosed between a tag and the corresponding end tag, including the tags themselves:

<tagExample>Element example</tagExample>

As the preceding example demonstrates, a tag is enclosed in a pair of angle brackets (or between the “less than” and “greater than” signs), and an end tag is identical to its corresponding tag, except that the opening angle bracket is immediately followed by the forward slash (/):

<emptyElementTag></emptyElementTag>

This example shows that an element may contain nothing between the tags. That's fine, too. There is even a shorthand expression for this:

<emptyElementTag/>

Okay, these examples are fine, as far as they go, but they don't really go very far. Much more interesting are elements that do contain things, and not just little bits of text, either. Before we consider what elements may contain, we should mention the element attributes. An element may have one or more attributes attached to it:

<element attribute1=“attr1Value” attribute2=“attr2Value”>contents</element>

Attributes are defined within the element tag, as key-value pairs, with the value part placed in the quotation marks. They are ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required