HOME
The Info List - XML



--- Advertisement ---


(i)

In computing , EXTENSIBLE MARKUP LANGUAGE (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable . The W3C 's XML
XML
1.0 Specification and several other related specifications —all of them free open standards —define XML.

The design goals of XML
XML
emphasize simplicity, generality, and usability across the Internet
Internet
. It is a textual data format with strong support via Unicode for different human languages . Although the design of XML
XML
focuses on documents, the language is widely used for the representation of arbitrary data structures such as those used in web services .

Several schema systems exist to aid in the definition of XML-based languages, while programmers have developed many application programming interfaces (APIs) to aid the processing of XML
XML
data.

CONTENTS

* 1 Applications of XML
XML
* 2 Key terminology

* 3 Characters and escaping

* 3.1 Valid characters * 3.2 Encoding detection * 3.3 Escaping * 3.4 Comments * 3.5 International use

* 4 Well-formedness and error-handling

* 5 Schemas and validation

* 5.1 Document Type Definition * 5.2 XML
XML
Schema * 5.3 RELAX NG * 5.4 Schematron * 5.5 DSDL and other schema languages

* 6 Related specifications

* 7 Programming interfaces

* 7.1 Simple API for XML * 7.2 Pull parsing * 7.3 Document Object Model * 7.4 Data binding * 7.5 XML
XML
as data type

* 8 History

* 8.1 Sources * 8.2 Versions

* 9 Criticism * 10 See also * 11 Notes * 12 References * 13 Further reading * 14 External links

APPLICATIONS OF XML

Hundreds of document formats using XML
XML
syntax have been developed, including RSS
RSS
, Atom , SOAP
SOAP
, SVG
SVG
, and XHTML . XML-based formats have become the default for many office-productivity tools, including Microsoft Office ( Office Open XML
Office Open XML
), OpenOffice.org and LibreOffice ( OpenDocument ), and Apple 's iWork . XML
XML
has also provided the base language for communication protocols such as XMPP . Applications for the Microsoft
Microsoft
.NET Framework use XML
XML
files for configuration. Apple has an implementation of a registry based on XML.

XML
XML
has come into common use for the interchange of data over the Internet. IETF RFC 7303 gives rules for the construction of Internet Media Types for use when sending XML. It also defines the media types _application/xml_ and _text/xml_, which say only that the data is in XML, and nothing about its semantics . The use of _text/xml_ has been criticized as a potential source of encoding problems and it has been suggested that it should be deprecated.

RFC 7303 also recommends that XML-based languages be given media types ending in _+xml_; for example _image/svg+xml_ for SVG
SVG
.

Further guidelines for the use of XML
XML
in a networked context appear in RFC 3470 , also known as IETF BCP 70, a document covering many aspects of designing and deploying an XML-based language.

KEY TERMINOLOGY

The material in this section is based on the XML
XML
Specification. This is not an exhaustive list of all the constructs that appear in XML; it provides an introduction to the key constructs most often encountered in day-to-day use. Character An XML
XML
document is a string of _characters_. Almost every legal Unicode character may appear in an XML
XML
document. Processor and application The _processor_ analyzes the markup and passes structured information to an _application_. The specification places requirements on what an XML
XML
processor must do and not do, but the application is outside its scope. The processor (as the specification calls it) is often referred to colloquially as an _ XML
XML
parser_. Markup and content The characters making up an XML document are divided into _markup_ and _content_, which may be distinguished by the application of simple syntactic rules. Generally, strings that constitute markup either begin with the character , or they begin with the character . Strings of characters that are not markup are content. However, in a CDATA section, the delimiters are classified as markup, while the text between them is classified as content. In addition, whitespace before and after the outermost element is classified as markup. Tag A _tag_ is a markup construct that begins with . Tags come in three flavors:

* _start-tag_, such as ; * _end-tag_, such as ; * _empty-element tag_, such as .

Element An _element_ is a logical document component that either begins with a start-tag and ends with a matching end-tag or consists only of an empty-element tag. The characters between the start-tag and end-tag, if any, are the element's _content_, and may contain markup, including other elements, which are called _child elements_. An example is Hello, world!. Another is . Attribute An _attribute_ is a markup construct consisting of a name–value pair that exists within a start-tag or empty-element tag. An example is , where the names of the attributes are "src" and "alt", and their values are "madonna.jpg" and "Madonna" respectively. Another example is Connect A to B., where the name of the attribute is "number" and its value is "3". An XML attribute can only have a single value and each attribute can appear at most once on each element. In the common situation where a list of multiple values is desired, this must be done by encoding the list into a well-formed XML
XML
attribute with some format beyond what XML defines itself. Usually this is either a comma or semi-colon delimited list or, if the individual values are known not to contain spaces, a space-delimited list can be used. Welcome!, where the attribute "class" has both the value "inner greeting-box" and also indicates the two CSS
CSS
class names "inner" and "greeting-box". XML
XML
declaration XML documents may begin with an _ XML
XML
declaration_ that describes some information about themselves. An example is .

CHARACTERS AND ESCAPING

XML
XML
documents consist entirely of characters from the Unicode repertoire. Except for a small number of specifically excluded control characters , any character defined by Unicode may appear within the content of an XML
XML
document.

XML
XML
includes facilities for identifying the _encoding_ of the Unicode characters that make up the document, and for expressing characters that, for one reason or another, cannot be used directly.

VALID CHARACTERS

Main article: Valid characters in XML

Unicode code points in the following ranges are valid in XML
XML
1.0 documents:

* U+0009 (Horizontal Tab), U+000A (Line Feed), U+000D (Carriage Return): these are the only C0 controls accepted in XML
XML
1.0; * U+0020–U+D7FF, U+E000–U+FFFD: this excludes _some_ (not all) non-characters in the BMP (all surrogates, U+FFFE and U+FFFF are forbidden); * U+10000–U+10FFFF: this includes _all_ code points in supplementary planes, including non-characters.

XML
XML
1.1 extends the set of allowed characters to include all the above, plus the remaining characters in the range U+0001–U+001F. At the same time, however, it restricts the use of C0 and C1 control characters other than U+0009 (Horizontal Tab), U+000A (Line Feed), U+000D (Carriage Return), and U+0085 (Next Line) by requiring them to be written in escaped form (for example U+0001 must be written as or its equivalent). In the case of C1 characters, this restriction is a backwards incompatibility; it was introduced to allow common encoding errors to be detected.

The code point U+0000 (Null) is the only character that is not permitted in any XML
XML
1.0 or 1.1 document.

ENCODING DETECTION

The Unicode character set can be encoded into bytes for storage or transmission in a variety of different ways, called "encodings". Unicode itself defines encodings that cover the entire repertoire; well-known ones include UTF-8 and UTF-16 . There are many other text encodings that predate Unicode, such as ASCII and ISO/IEC 8859 ; their character repertoires in almost every case are subsets of the Unicode character set.

XML
XML
allows the use of any of the Unicode-defined encodings, and any other encodings whose characters also appear in Unicode. XML
XML
also provides a mechanism whereby an XML
XML
processor can reliably, without any prior knowledge, determine which encoding is being used. Encodings other than UTF-8 and UTF-16 are not necessarily recognized by every XML