XML definition and basics


XML introduces a lot of terminology and concepts that can be new and confusing to SQL developers, or developers coming from other languages. In this article we will discuss some of these basic concepts. The actual meaning of XML is Extensible Markup Language and it is a specification for creating custom markup languages. A markup language is an artificial language that consists of textual annotations, or markup tags, that control the structure or display of textual data. XML allows you to create your own custom markup language, meaning you define the markup tags that give structure and additional context to your textual data. For instance, let's consider an XML document that consists of a root-level markup tag named country. Nested within this tag, in a hierarchical structure, is a states markup tag with additional state tags nested within it, and so on. XML is handy for representing hierarchical textual data, and is useful for manipulating and sharing text-based data over the internet. The XML specification divides the different types of supported markup annotations into logical structures known as nodes. Nodes are a useful logical construct for working with XML content. A node can be one of the following types:

Element nodes-Element nodes consist of markup tags that wrap other nodes and textual data.
Attribute nodes-Attribute nodes are name/value pairs associated with element nodes.
Text nodes-Text nodes are the bottom-level nodes that contain character data within element nodes.
Comment nodes-Comment nodes are human-readable comments that can appear anywhere in XML documents outside of other markup.

Processing instructions-Processing instructions provide a means to pass additional information to the application parsing the XML data. Processing instructions are indicated by delimiting them with <? and ?>.

XML data can be logically viewed as a set of nodes in a hierarchical tree structure. The XML node tree structure works well in support of other XML-based processing and manipulation recommendations that logically view XML data as hierarchical treelike structures. These recommendations include XML Infoset, XML Schema, XML DOM, and XQuery/XPath Data Model, to name a few. Each of these recommendations can define extra node types in addition to these basic node types, such as document nodes and namespace nodes. XML data must conform to certain syntactical requirements. XML that follows the syntactical requirements below is considered well-formed:

1. Well-formed XML data must contain one or more elements.
2. Well-formed XML data must contain one, and only one, root element.
3. Well-formed XML data must have all elements properly nested within one another. This means no overlapping start and end tags.

The start and end tags of the states element don't overlap the other tags, such as the nested state, abbreviation, and name tags. In addition to these requirements, XML character data must be properly entitized. XML data that conforms to all of these rules is considered well-formed. XML data that isn't well-formed must still follow these rules, with one exception: it can have more than one root node. Take, for instance an XML document that isn't well-formed because it has multiple top-level elements. It still must conform to all other rules for well-formed documents, though. XML data that follows all of the rules for well-formedness, other than the requirement of a single root node, is sometimes referred to as an XML fragment.

Legal Disclaimer

Our website is not responsible for the information contained by this article. Articleinput.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.

Note: This article was sent to us by: Dale Olson at 01092010

Related Articles

1. What can be used as a key in Python
Python permits more than just strings to be used in this manner. Any Python object that is immutable and hashable can be used as a key to a dic...

2. Definitions and uses of functions in Python
This article assumes you're familiar with function definitions in at least one other computer language and with the concepts that correspond to...

3. Python functions handle variable numbers of arguments
Python functions can also be defined to handle variable numbers of arguments. You can do this two different ways. One way handles the relativel...

4. Lambda expressions and generator functions in Python
Short functions like those you just saw can also be defined using lambda expressions of the form. Lambda expressions are anonymous little funct...

5. How to create a basic program in Python
Up until now, you've been using the Python interpreter mainly in interactive mode. For production use, you'll want to create Python programs or...

6. How to make Python script execution in UNIX and Mac OS X and in Windows
If you're on UNIX, you can easily make a script directly executable. Note that if Python 3.x isn't your default version of Python, you may need...

7. The difference between scripts on Windows scripts on UNIX
The way you call scripts on Windows differs from the way scripts are called on Linux/ UNIX, and that difference can affect what kind of scripts...

8. Python applications are distributed as source files
You can distribute your scripts as source files (as .py files). You can also ship them as byte code (as .pyc or .pyo files). A byte code file w...