17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The declaration is made with a special tag that begins with a question mark (which indicates that this<br />

tag is a preprocessor directive) and the xml moniker:<br />

<br />

The declaration has one required attribute (something that further describes the element) — the version.<br />

In the preceding example, we’ve declared that this is an XML document and also that it is to comply<br />

with version 1.0 (as of this writing, there is also a version 1.1, though you’ll want to stick with 1.0 wherever<br />

possible) of the XML specification.<br />

The declaration can optionally have one additional attribute — this one is called encoding, and it<br />

describes the nature of the character set this XML document utilizes. XML can handle a few different<br />

character sets, most notably UTF-16 and UTF-8. UTF-16 is essentially the Unicode specification, which is<br />

a 16-bit encoding specification that allows for most characters in use in the world today. The default<br />

encoding method is UTF-8, which is backward compatible to the older ASCII specification. A full declaration<br />

would look like this:<br />

Elements<br />

<br />

Elements that start with the letters xml are strictly forbidden by the specification — instead, they are<br />

reserved for future expansion of the language.<br />

Elements serve as a piece of glue to hold together descriptive information about something — it honestly<br />

could be anything. Elements define a clear start and end point for your descriptive information.<br />

Usually, elements exist in matched pairs of tags known as an opening tag and a closing tag. Optionally,<br />

however, the opening tag can be self-closing — essentially defining what is known as an empty<br />

element.<br />

The structure for an XML element looks pretty much as HTML tags do. An opening tag will begin with<br />

an opening angle bracket ():<br />

<br />

The exception to the rule is if the element is self-closing, in which case the closing angle bracket of the<br />

opening tag is preceded with a forward slash (/):<br />

<br />

Closing tags will look exactly like the opening tag (case sensitive), but start with a slash (/) before the<br />

name of the element it’s closing:<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!