What Is a Well Formed XML Document

An XML document must have one root element. While in HTML the root element is always <HTML>, in the XML document you can name your root element anything you want. Element names must begin with a letter or underscore character. The root element must enclose all other elements, and elements must be properly nested. The XML data must be hierarchical; the beginning and ending tags cannot overlap.

<Employee>

<Employee Id>090909</Employee Id> </Employee>

All element tags must be closed. A begin tag must be followed by an end tag:

Taking Your VBA Programming Skills to the Web

<Sessions>5</Sessions>

You can use shortcuts, such as a single slash (/), to end the tag so you don't have to type the full tag name. For example, if the current Sessions element is empty (does not have value), you could use the following tag:

Tag names are case-sensitive: The tags <Title> and </Title> aren't equivalent to <TITLE> and </TITLE>. For example, the following line:

<Title>Beginning VBA Progranrrring</Title> is not the same as:

<TITLE>Beginning VBA Programming</TITLE> All attributes must be in quotation marks: <Course Id="VBAEX1"/>

You cannot have more than one attribute with the same name within the same element. If the <Course> element has two Id attributes, they must be written separately, as shown below:

<Course Id="VBAEX1"/> <Course Id="VBAEX2"/>

The main goals of XML are the separation of content from presentation, and the portability of the data.

It is important to understand that XML was designed to address the limitations of HTML and not to replace it. One of these limitations is the inability of HTML to identify data. By using XML tags you can give meaning to the data in the document and provide a consistent way of identifying each item of data. By separating content from presentation and structuring data based on its meaning, we are finally able to create documents that are easy to reuse, manipulate, and search.

So, let's get started with XML in Access.

0 0

Post a comment