Key terminology::XML
::concepts
Document::which Title::unicode Language::schema Example::syntax Markup::other Markup::encoding
Key terminology
The material in this section is based on the 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.
- (Unicode) character
- By definition, an XML document is a string of characters. Almost every legal Unicode character may appear in an 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 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 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
<
and end with a>
, or they begin with the character&
and end with a;
. Strings of characters that are not markup are content. However, in a CDATA section, the delimiters<![CDATA[
and]]>
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 markup construct that begins with
<
and ends with>
. Tags come in three flavors:- start-tags; for example:
<section>
- end-tags; for example:
</section>
- empty-element tags; for example:
<line-break />
- start-tags; for example:
- Element
- A logical document component which 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- and end-tags, if any, are the element's content, and may contain markup, including other elements, which are called child elements. An example of an element is
<Greeting>Hello, world.</Greeting>
. Another is<line-break />
.
- Attribute
- A markup construct consisting of a name/value pair that exists within a start-tag or empty-element tag. In the example (below) the element img has two attributes, src and alt:
- <source lang="xml"><img src="madonna.jpg" alt='Foligno Madonna, by Raphael' /></source> Another example would be
- <source lang="xml"><step number="3">Connect A to B.</step></source> where the name of the attribute is "number" and the 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 attribute<ref group="note" >i.e., embedded quote characters would be a problem</ref> 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,<ref group="note" >A common example of this would be for CSS class or identifier names.</ref> a space-delimited list can be used.
- <source lang="xml">Hello!</source> where the attribute "class" has both the value "inner greeting-box" and also indicates the two CSS class names "inner" and "greeting-box".
- XML declaration
- XML documents may begin by declaring some information about themselves, as in the following example:
- <source lang="xml"><?xml version="1.0" encoding="UTF-8"?></source>
XML sections
Intro Applications of XML Key terminology Characters and escaping Well-formedness and error-handling Schemas and validation Related specifications Programming interfaces History Criticism See also Notes References Further reading External links
Key terminology | |
PREVIOUS: Applications of XML | NEXT: Characters and escaping |
<< | >> |