XML is limited to describing how data should be presented in the form of Web pages

Extensible Markup Language, abbreviated XML, describes a class of data objects called and partially describes the behavior of computer programs which process them. XML is an application profile or restricted form of SGML, the Standard Generalized Markup Language . By construction, XML documents are conforming SGML documents.

XML documents are made up of storage units called , which contain either parsed or unparsed data. Parsed data is made up of , some of which form , and some of which form . Markup encodes a description of the document's storage layout and logical structure. XML provides a mechanism to impose constraints on the storage layout and logical structure.

[Definition: A software module called an XML processor is used to read XML documents and provide access to their content and structure.] [Definition: It is assumed that an XML processor is doing its work on behalf of another module, called the application.] This specification describes the required behavior of an XML processor in terms of how it must read XML data and the information it must provide to the application.

1.1 Origin and Goals

XML was developed by an XML Working Group (originally known as the SGML Editorial Review Board) formed under the auspices of the World Wide Web Consortium (W3C) in 1996. It was chaired by Jon Bosak of Sun Microsystems with the active participation of an XML Special Interest Group (previously known as the SGML Working Group) also organized by the W3C. The membership of the XML Working Group is given in an appendix. Dan Connolly served as the Working Group's contact with the W3C.

The design goals for XML are:

  1. XML shall be straightforwardly usable over the Internet.

  2. XML shall support a wide variety of applications.

  3. XML shall be compatible with SGML.

  4. It shall be easy to write programs which process XML documents.

  5. The number of optional features in XML is to be kept to the absolute minimum, ideally zero.

  6. XML documents should be human-legible and reasonably clear.

  7. The XML design should be prepared quickly.

  8. The design of XML shall be formal and concise.

  9. XML documents shall be easy to create.

  10. Terseness in XML markup is of minimal importance.

This specification, together with associated standards (Unicode and ISO/IEC 10646 for characters, Internet BCP 47 and the Language Subtag Registry for language identification tags), provides all the information necessary to understand XML Version 1.0 and construct computer programs to process it.

This version of the XML specification may be distributed freely, as long as all text and legal notices remain intact.

1.2 Terminology

The terminology used to describe XML documents is defined in the body of this specification. The key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL, when EMPHASIZED, are to be interpreted as described in . In addition, the terms defined in the following list are used in building those definitions and in describing the actions of an XML processor:

error

[Definition: A violation of the rules of this specification; results are undefined. Unless otherwise specified, failure to observe a prescription of this specification indicated by one of the keywords MUST, REQUIRED, MUST NOT, SHALL and SHALL NOT is an error. Conforming software MAY detect and report an error and MAY recover from it.]

fatal error

[Definition: An error which a conforming MUST detect and report to the application. After encountering a fatal error, the processor MAY continue processing the data to search for further errors and MAY report such errors to the application. In order to support correction of errors, the processor MAY make unprocessed data from the document (with intermingled character data and markup) available to the application. Once a fatal error is detected, however, the processor MUST NOT continue normal processing (i.e., it MUST NOT continue to pass character data and information about the document's logical structure to the application in the normal way).]

at user option

[Definition: Conforming software MAY or MUST (depending on the modal verb in the sentence) behave as described; if it does, it MUST provide users a means to enable or disable the behavior described.]

validity constraint

[Definition: A rule which applies to all XML documents. Violations of validity constraints are errors; they MUST, at user option, be reported by .]

well-formedness constraint

[Definition: A rule which applies to all XML documents. Violations of well-formedness constraints are .]

match

[Definition: (Of strings or names:) Two strings or names being compared are identical. Characters with multiple possible representations in ISO/IEC 10646 (e.g. characters with both precomposed and base+diacritic forms) match only if they have the same representation in both strings. No case folding is performed. (Of strings and rules in the grammar:) A string matches a grammatical production if it belongs to the language generated by that production. (Of content and content models:) An element matches its declaration when it conforms in the fashion described in the constraint [VC: ].]

for compatibility

[Definition: Marks a sentence describing a feature of XML included solely to ensure that XML remains compatible with SGML.]

for interoperability

[Definition: Marks a sentence describing a non-binding recommendation included to increase the chances that XML documents can be processed by the existing installed base of SGML processors which predate the WebSGML Adaptations Annex to ISO 8879.]

2 Documents

[Definition: A data object is an XML document if it is , as defined in this specification. In addition, the XML document is if it meets certain further constraints.]

Each XML document has both a logical and a physical structure. Physically, the document is composed of units called . An entity may to other entities to cause their inclusion in the document. A document begins in a "root" or . Logically, the document is composed of declarations, elements, comments, character references, and processing instructions, all of which are indicated in the document by explicit markup. The logical and physical structures MUST nest properly, as described in .

2.1 Well-Formed XML Documents

[Definition: A textual object is a well-formed XML document if:]

  1. Taken as a whole, it matches the production labeled .

  2. It meets all the well-formedness constraints given in this specification.

  3. Each of the which is referenced directly or indirectly within the document is .

Document[1]   <?xml version="1.0"?> <greeting>Hello, world!</greeting> 2   ::=   <?xml version="1.0"?> <greeting>Hello, world!</greeting> 3

Matching the production implies that:

  1. It contains one or more .

  2. [Definition: There is exactly one element, called the root, or document element, no part of which appears in the of any other element.] For all other elements, if the is in the content of another element, the is in the content of the same element. More simply stated, the elements, delimited by start- and end-tags, nest properly within each other.

[Definition: As a consequence of this, for each non-root element <?xml version="1.0"?> <greeting>Hello, world!</greeting> 4 in the document, there is one other element <?xml version="1.0"?> <greeting>Hello, world!</greeting> 5 in the document such that <?xml version="1.0"?> <greeting>Hello, world!</greeting> 4 is in the content of <?xml version="1.0"?> <greeting>Hello, world!</greeting> 5, but is not in the content of any other element that is in the content of <?xml version="1.0"?> <greeting>Hello, world!</greeting> 5. <?xml version="1.0"?> <greeting>Hello, world!</greeting> 5 is referred to as the parent of <?xml version="1.0"?> <greeting>Hello, world!</greeting> 4, and <?xml version="1.0"?> <greeting>Hello, world!</greeting> 4 as a child of <?xml version="1.0"?> <greeting>Hello, world!</greeting> 5.]

2.2 Characters

[Definition: A parsed entity contains text, a sequence of , which may represent markup or character data.] [Definition: A character is an atomic unit of text as specified by ISO/IEC 10646:2000 . Legal characters are tab, carriage return, line feed, and the legal characters of Unicode and ISO/IEC 10646. The versions of these standards cited in were current at the time this document was prepared. New characters may be added to these standards by amendments or new editions. Consequently, XML processors MUST accept any character in the range specified for . ]

Character Range[2]   <greeting>Hello, world!</greeting>3   ::=   <greeting>Hello, world!</greeting>4/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */

The mechanism for encoding character code points into bit patterns may vary from entity to entity. All XML processors MUST accept the UTF-8 and UTF-16 encodings of Unicode ; the mechanisms for signaling which of the two is in use, or for bringing other encodings into play, are discussed later, in .

Note:

Document authors are encouraged to avoid "compatibility characters", as defined in section 2.3 of . The characters defined in the following ranges are also discouraged. They are either control characters or permanently undefined Unicode characters:

[#x7F-#x84], [#x86-#x9F], [#xFDD0-#xFDEF], [#x1FFFE-#x1FFFF], [#x2FFFE-#x2FFFF], [#x3FFFE-#x3FFFF], [#x4FFFE-#x4FFFF], [#x5FFFE-#x5FFFF], [#x6FFFE-#x6FFFF], [#x7FFFE-#x7FFFF], [#x8FFFE-#x8FFFF], [#x9FFFE-#x9FFFF], [#xAFFFE-#xAFFFF], [#xBFFFE-#xBFFFF], [#xCFFFE-#xCFFFF], [#xDFFFE-#xDFFFF], [#xEFFFE-#xEFFFF], [#xFFFFE-#xFFFFF], [#x10FFFE-#x10FFFF].

2.3 Common Syntactic Constructs

This section defines some symbols used widely in the grammar.

(white space) consists of one or more space (#x20) characters, carriage returns, line feeds, or tabs.

White Space[3]   <greeting>Hello, world!</greeting>5   ::=   <greeting>Hello, world!</greeting>6

Note:

The presence of #xD in the above production is maintained purely for backward compatibility with the First Edition. As explained in , all #xD characters literally present in an XML document are either removed or replaced by #xA characters before any other processing is done. The only way to get a #xD character to match this production is to use a character reference in an entity value literal.

An (name token) is any mixture of name characters.

[Definition: A is an with a restricted set of initial characters.] Disallowed initial characters for include digits, diacritics, the full stop and the hyphen.

Names beginning with the string "<greeting>Hello, world!</greeting>7", or with any string which would match <greeting>Hello, world!</greeting>8, are reserved for standardization in this or future versions of this specification.

Note:

The Namespaces in XML Recommendation assigns a meaning to names containing colon characters. Therefore, authors should not use the colon in XML names except for namespace purposes, but XML processors must accept the colon as a name character.

The first character of a MUST be a , and any other characters MUST be ; this mechanism is used to prevent names from beginning with European (ASCII) digits or with basic combining characters. Almost all characters are permitted in names, except those which either are or reasonably could be used as delimiters. The intention is to be inclusive rather than exclusive, so that writing systems not yet encoded in Unicode can be used in XML names. See for suggestions on the creation of names.

Document authors are encouraged to use names which are meaningful words or combinations of words in natural languages, and to avoid symbolic or white space characters in names. Note that COLON, HYPHEN-MINUS, FULL STOP (period), LOW LINE (underscore), and MIDDLE DOT are explicitly permitted.

The ASCII symbols and punctuation marks, along with a fairly large group of Unicode symbol characters, are excluded from names because they are more useful as delimiters in contexts where XML names are used outside XML documents; providing this group gives those contexts hard guarantees about what cannot be part of an XML name. The character #x037E, GREEK QUESTION MARK, is excluded because when normalized it becomes a semicolon, which could change the meaning of entity references.

Names and Tokens[4]   <greeting>Hello, world!</greeting>9   ::=   <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> 0[4a]   <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> 1   ::=   <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> 2[5]   <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> 3   ::=   <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> 4[6]   <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> 5   ::=   <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> 6[7]   <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> 7   ::=   <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> 8[8]   <?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting> 9   ::=   <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>0

Note:

The and productions are used to define the validity of tokenized attribute values after normalization (see ).

Literal data is any quoted string not containing the quotation mark used as a delimiter for that string. Literals are used for specifying the content of internal entities (), the values of attributes (), and external identifiers (). Note that a can be parsed without scanning for markup.

Literals[9]   <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>1   ::=   <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>2<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>3[10]   <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>4   ::=   <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>5<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>6[11]   <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>7   ::=   <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>8[12]   <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>9   ::=   <?xml version="1.0" standalone='yes'?>0[13]   <?xml version="1.0" standalone='yes'?>1   ::=   <?xml version="1.0" standalone='yes'?>2

Note:

Although the production allows the definition of a general entity consisting of a single explicit <?xml version="1.0" standalone='yes'?>3 in the literal (e.g., <?xml version="1.0" standalone='yes'?>4), it is strongly advised to avoid this practice since any reference to that entity will cause a well-formedness error.

2.4 Character Data and Markup

consists of intermingled and markup. [Definition: Markup takes the form of , , , , , , delimiters, , , , , and any white space that is at the top level of the document entity (that is, outside the document element and not inside any other markup).]

[Definition: All text that is not markup constitutes the character data of the document.]

The ampersand character (&) and the left angle bracket (<) MUST NOT appear in their literal form, except when used as markup delimiters, or within a , a , or a . If they are needed elsewhere, they MUST be using either or the strings " <?xml version="1.0" standalone='yes'?>5 " and " <?xml version="1.0" standalone='yes'?>6 " respectively. The right angle bracket (>) may be represented using the string " <?xml version="1.0" standalone='yes'?>7 ", and MUST, , be escaped using either " <?xml version="1.0" standalone='yes'?>7 " or a character reference when it appears in the string " <?xml version="1.0" standalone='yes'?>9 " in content, when that string is not marking the end of a .

In the content of elements, character data is any string of characters which does not contain the start-delimiter of any markup and does not include the CDATA-section-close delimiter, " <?xml version="1.0" standalone='yes'?>9 ". In a CDATA section, character data is any string of characters not including the CDATA-section-close delimiter, " <?xml version="1.0" standalone='yes'?>9 ".

To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character (') may be represented as " <!ATTLIST poem xml:space (default|preserve) 'preserve'> <!ATTLIST pre xml:space (preserve) #FIXED 'preserve'>2 ", and the double-quote character (") as " <!ATTLIST poem xml:space (default|preserve) 'preserve'> <!ATTLIST pre xml:space (preserve) #FIXED 'preserve'>3 ".

Character Data[14]   <!ATTLIST poem xml:space (default|preserve) 'preserve'> <!ATTLIST pre xml:space (preserve) #FIXED 'preserve'>4   ::=   <!ATTLIST poem xml:space (default|preserve) 'preserve'> <!ATTLIST pre xml:space (preserve) #FIXED 'preserve'>5

2.5 Comments

[Definition: Comments may appear anywhere in a document outside other ; in addition, they may appear within the document type declaration at places allowed by the grammar. They are not part of the document's ; an XML processor MAY, but need not, make it possible for an application to retrieve the text of comments. , the string " <!ATTLIST poem xml:space (default|preserve) 'preserve'> <!ATTLIST pre xml:space (preserve) #FIXED 'preserve'>6 " (double-hyphen) MUST NOT occur within comments.] Parameter entity references MUST NOT be recognized within comments.

Comments[15]   <!ATTLIST poem xml:space (default|preserve) 'preserve'> <!ATTLIST pre xml:space (preserve) #FIXED 'preserve'>7   ::=   <!ATTLIST poem xml:space (default|preserve) 'preserve'> <!ATTLIST pre xml:space (preserve) #FIXED 'preserve'>8

An example of a comment:

<!-- declarations for <head> & <body> -->

Note that the grammar does not allow a comment ending in <!ATTLIST poem xml:space (default|preserve) 'preserve'> <!ATTLIST pre xml:space (preserve) #FIXED 'preserve'>9. The following example is not well-formed.

<!-- B+, B, or B--->

2.6 Processing Instructions

[Definition: Processing instructions (PIs) allow documents to contain instructions for applications.]

Processing Instructions[16]   <!-- declarations for <head> & <body> -->00   ::=   <!-- declarations for <head> & <body> -->01[17]   <!-- declarations for <head> & <body> -->02   ::=   <!-- declarations for <head> & <body> -->03

PIs are not part of the document's , but MUST be passed through to the application. The PI begins with a target () used to identify the application to which the instruction is directed. The target names " <!-- declarations for <head> & <body> -->04 ", " <greeting>Hello, world!</greeting>7 ", and so on are reserved for standardization in this or future versions of this specification. The XML mechanism may be used for formal declaration of PI targets. Parameter entity references MUST NOT be recognized within processing instructions.

2.7 CDATA Sections

[Definition: CDATA sections may occur anywhere character data may occur; they are used to escape blocks of text containing characters which would otherwise be recognized as markup. CDATA sections begin with the string " <!-- declarations for <head> & <body> -->06 " and end with the string " <?xml version="1.0" standalone='yes'?>9 ":]

CDATA Sections[18]   <!-- declarations for <head> & <body> -->08   ::=   <!-- declarations for <head> & <body> -->09[19]   <!-- declarations for <head> & <body> -->10   ::=   <!-- declarations for <head> & <body> -->11[20]   <!-- declarations for <head> & <body> -->12   ::=   <!-- declarations for <head> & <body> -->13[21]   <!-- declarations for <head> & <body> -->14   ::=   <!-- declarations for <head> & <body> -->15

Within a CDATA section, only the string is recognized as markup, so that left angle brackets and ampersands may occur in their literal form; they need not (and cannot) be escaped using " <?xml version="1.0" standalone='yes'?>6 " and " <?xml version="1.0" standalone='yes'?>5 ". CDATA sections cannot nest.

An example of a CDATA section, in which " <!-- declarations for <head> & <body> -->18 " and " <!-- declarations for <head> & <body> -->19 " are recognized as , not :

<![CDATA[<greeting>Hello, world!</greeting>]]>

2.8 Prolog and Document Type Declaration

[Definition: XML documents SHOULD begin with an XML declaration which specifies the version of XML being used.] For example, the following is a complete XML document, but not :

<?xml version="1.0"?> <greeting>Hello, world!</greeting>

and so is this:

<greeting>Hello, world!</greeting>

The function of the markup in an XML document is to describe its storage and logical structure and to associate attribute name-value pairs with its logical structures. XML provides a mechanism, the , to define constraints on the logical structure and to support the use of predefined storage units. [Definition: An XML document is valid if it has an associated document type declaration and if the document complies with the constraints expressed in it.]

The document type declaration MUST appear before the first in the document.

Prolog[22]   <!-- declarations for <head> & <body> -->20   ::=   <!-- declarations for <head> & <body> -->21[23]   <!-- declarations for <head> & <body> -->22   ::=   <!-- declarations for <head> & <body> -->23[24]   <!-- declarations for <head> & <body> -->24   ::=   <!-- declarations for <head> & <body> -->25[25]   <!-- declarations for <head> & <body> -->26   ::=   <!-- declarations for <head> & <body> -->27[26]   <!-- declarations for <head> & <body> -->28   ::=   <!-- declarations for <head> & <body> -->29[27]   <!-- declarations for <head> & <body> -->30   ::=   <!-- declarations for <head> & <body> -->31

Even though the production matches any version number of the form '1.x', XML 1.0 documents SHOULD NOT specify a version number other than '1.0'.

Note:

When an XML 1.0 processor encounters a document that specifies a 1.x version number other than '1.0', it will process it as a 1.0 document. This means that an XML 1.0 processor will accept 1.x documents provided they do not use any non-1.0 features.

[Definition: The XML document type declaration contains or points to that provide a grammar for a class of documents. This grammar is known as a document type definition, or DTD. The document type declaration can point to an external subset (a special kind of ) containing markup declarations, or can contain the markup declarations directly in an internal subset, or can do both. The DTD for a document consists of both subsets taken together.]

[Definition: A markup declaration is an , an , an , or a .] These declarations may be contained in whole or in part within , as described in the well-formedness and validity constraints below. For further information, see .

Document Type Definition[28]   <!-- declarations for <head> & <body> -->32   ::=   <!-- declarations for <head> & <body> -->33[28a]   <!-- declarations for <head> & <body> -->34   ::=   <!-- declarations for <head> & <body> -->35[28b]   <!-- declarations for <head> & <body> -->36   ::=   <!-- declarations for <head> & <body> -->37[29]   <!-- declarations for <head> & <body> -->38   ::=   <!-- declarations for <head> & <body> -->39

Note that it is possible to construct a well-formed document containing a that neither points to an external subset nor contains an internal subset.

The markup declarations may be made up in whole or in part of the of . The productions later in this specification for individual nonterminals (, , and so on) describe the declarations after all the parameter entities have been .

Parameter entity references are recognized anywhere in the DTD (internal and external subsets and external parameter entities), except in literals, processing instructions, comments, and the contents of ignored conditional sections (see ). They are also recognized in entity value literals. The use of parameter entities in the internal subset is restricted as described below.

Validity constraint: Root Element Type

The in the document type declaration MUST match the element type of the .

Validity constraint: Proper Declaration/PE Nesting

Parameter-entity MUST be properly nested with markup declarations. That is to say, if either the first character or the last character of a markup declaration ( above) is contained in the replacement text for a , both MUST be contained in the same replacement text.

Well-formedness constraint: PEs in Internal Subset

In the internal DTD subset, MUST NOT occur within markup declarations; they may occur where markup declarations can occur. (This does not apply to references that occur in external parameter entities or to the external subset.)

Well-formedness constraint: External Subset

The external subset, if any, MUST match the production for .

Well-formedness constraint: PE Between Declarations

The replacement text of a parameter entity reference in a MUST match the production .

Like the internal subset, the external subset and any external parameter entities referenced in a MUST consist of a series of complete markup declarations of the types allowed by the non-terminal symbol , interspersed with white space or . However, portions of the contents of the external subset or of these external parameter entities may conditionally be ignored by using the construct; this is not allowed in the internal subset but is allowed in external parameter entities referenced in the internal subset.

External Subset[30]   <!-- declarations for <head> & <body> -->40   ::=   <!-- declarations for <head> & <body> -->41[31]   <!-- declarations for <head> & <body> -->42   ::=   <!-- declarations for <head> & <body> -->43

The external subset and external parameter entities also differ from the internal subset in that in them, are permitted within markup declarations, not only between markup declarations.

An example of an XML document with a document type declaration:

<?xml version="1.0"?> <!DOCTYPE greeting SYSTEM "hello.dtd"> <greeting>Hello, world!</greeting>

The " <!-- declarations for <head> & <body> -->44 " gives the address (a URI reference) of a DTD for the document.

The declarations can also be given locally, as in this example:

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE greeting [ <!ELEMENT greeting (#PCDATA)> ]> <greeting>Hello, world!</greeting>

If both the external and internal subsets are used, the internal subset MUST be considered to occur before the external subset. This has the effect that entity and attribute-list declarations in the internal subset take precedence over those in the external subset.

2.9 Standalone Document Declaration

Markup declarations can affect the content of the document, as passed from an to an application; examples are attribute defaults and entity declarations. The standalone document declaration, which may appear as a component of the XML declaration, signals whether or not there are such declarations which appear external to the or in parameter entities. [Definition: An external markup declaration is defined as a markup declaration occurring in the external subset or in a parameter entity (external or internal, the latter being included because non-validating processors are not required to read them).]

Standalone Document Declaration[32]   <!-- declarations for <head> & <body> -->45   ::=   <!-- declarations for <head> & <body> -->46

In a standalone document declaration, the value "yes" indicates that there are no which affect the information passed from the XML processor to the application. The value "no" indicates that there are or may be such external markup declarations. Note that the standalone document declaration only denotes the presence of external declarations; the presence, in a document, of references to external entities, when those entities are internally declared, does not change its standalone status.

If there are no external markup declarations, the standalone document declaration has no meaning. If there are external markup declarations but there is no standalone document declaration, the value "no" is assumed.

Any XML document for which <!-- declarations for <head> & <body> -->47 holds can be converted algorithmically to a standalone document, which may be desirable for some network delivery applications.

Validity constraint: Standalone Document Declaration

The standalone document declaration MUST have the value "no" if any external markup declarations contain declarations of:

  • attributes with values, if elements to which these attributes apply appear in the document without specifications of values for these attributes, or

  • entities (other than <!-- declarations for <head> & <body> -->48, <!-- declarations for <head> & <body> -->49, <!-- declarations for <head> & <body> -->50, <!-- declarations for <head> & <body> -->51, <!-- declarations for <head> & <body> -->52), if to those entities appear in the document, or

  • attributes with tokenized types, where the attribute appears in the document with a value such that will produce a different value from that which would be produced in the absence of the declaration, or

  • element types with , if white space occurs directly within any instance of those types.

An example XML declaration with a standalone document declaration:

<?xml version="1.0" standalone='yes'?>

2.10 White Space Handling

In editing XML documents, it is often convenient to use "white space" (spaces, tabs, and blank lines) to set apart the markup for greater readability. Such white space is typically not intended for inclusion in the delivered version of the document. On the other hand, "significant" white space that should be preserved in the delivered version is common, for example in poetry and source code.

An MUST always pass all characters in a document that are not markup through to the application. A MUST also inform the application which of these characters constitute white space appearing in .

A special named <!-- declarations for <head> & <body> -->53 may be attached to an element to signal an intention that in that element, white space should be preserved by applications. In valid documents, this attribute, like any other, MUST be if it is used. When declared, it MUST be given as an whose values are one or both of "default" and "preserve". For example:

<!ATTLIST poem xml:space (default|preserve) 'preserve'> <!ATTLIST pre xml:space (preserve) #FIXED 'preserve'>

The value "default" signals that applications' default white-space processing modes are acceptable for this element; the value "preserve" indicates the intent that applications preserve all the white space. This declared intent is considered to apply to all elements within the content of the element where it is specified, unless overridden with another instance of the <!-- declarations for <head> & <body> -->53 attribute. This specification does not give meaning to any value of <!-- declarations for <head> & <body> -->53 other than "default" and "preserve". It is an error for other values to be specified; the XML processor MAY report the error or MAY recover by ignoring the attribute specification or by reporting the (erroneous) value to the application. Applications may ignore or reject erroneous values.

The of any document is considered to have signaled no intentions as regards application space handling, unless it provides a value for this attribute or the attribute is declared with a default value.

2.11 End-of-Line Handling

XML are often stored in computer files which, for editing convenience, are organized into lines. These lines are typically separated by some combination of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).

To simplify the tasks of , the MUST behave as if it normalized all line breaks in external parsed entities (including the document entity) on input, before parsing, by translating both the two-character sequence #xD #xA and any #xD that is not followed by #xA to a single #xA character.

2.12 Language Identification

In document processing, it is often useful to identify the natural or formal language in which the content is written. A special named <!-- declarations for <head> & <body> -->56 may be inserted in documents to specify the language used in the contents and attribute values of any element in an XML document. In valid documents, this attribute, like any other, MUST be if it is used. The values of the attribute are language identifiers as defined by , Tags for the Identification of Languages; in addition, the empty string may be specified.

(Productions 33 through 38 have been removed.)

For example:

<!-- declarations for <head> & <body> -->0

The language specified by <!-- declarations for <head> & <body> -->56 applies to the element where it is specified (including the values of its attributes), and to all elements in its content unless overridden with another instance of <!-- declarations for <head> & <body> -->56. In particular, the empty value of <!-- declarations for <head> & <body> -->56 is used on an element B to override a specification of <!-- declarations for <head> & <body> -->56 on an enclosing element A, without specifying another language. Within B, it is considered that there is no language information available, just as if <!-- declarations for <head> & <body> -->56 had not been specified on B or any of its ancestors. Applications determine which of an element's attribute values and which parts of its character content, if any, are treated as language-dependent values described by <!-- declarations for <head> & <body> -->56.

Note:

Language information may also be provided by external transport protocols (e.g. HTTP or MIME). When available, this information may be used by XML applications, but the more local information provided by <!-- declarations for <head> & <body> -->56 should be considered to override it.

A simple declaration for <!-- declarations for <head> & <body> -->56 might take the form

<!-- declarations for <head> & <body> -->1

but specific default values may also be given, if appropriate. In a collection of French poems for English students, with glosses and notes in English, the <!-- declarations for <head> & <body> -->56 attribute might be declared this way:

<!-- declarations for <head> & <body> -->2

3 Logical Structures

[Definition: Each contains one or more elements, the boundaries of which are either delimited by and , or, for elements, by an . Each element has a type, identified by name, sometimes called its "generic identifier" (GI), and may have a set of attribute specifications.] Each attribute specification has a and a .

Element[39]   <!-- declarations for <head> & <body> -->66   ::=   <!-- declarations for <head> & <body> -->67<!-- declarations for <head> & <body> -->68

This specification does not constrain the application semantics, use, or (beyond syntax) names of the element types and attributes, except that names beginning with a match to <!-- declarations for <head> & <body> -->69 are reserved for standardization in this or future versions of this specification.

Well-formedness constraint: Element Type Match

The in an element's end-tag MUST match the element type in the start-tag.

Validity constraint: Element Valid

An element is valid if there is a declaration matching where the matches the element type, and one of the following holds:

  1. The declaration matches EMPTY and the element has no (not even entity references, comments, PIs or white space).

  2. The declaration matches and the sequence of belongs to the language generated by the regular expression in the content model, with optional white space, comments and PIs (i.e. markup matching production [27] ) between the start-tag and the first child element, between child elements, or between the last child element and the end-tag. Note that a CDATA section containing only white space or a reference to an entity whose replacement text is character references expanding to white space do not match the nonterminal , and hence cannot appear in these positions; however, a reference to an internal entity with a literal value consisting of character references expanding to white space does match , since its replacement text is the white space resulting from expansion of the character references.

  3. The declaration matches , and the content (after replacing any entity references with their replacement text) consists of (including ), , and whose types match names in the content model.

  4. The declaration matches ANY, and the content (after replacing any entity references with their replacement text) consists of character data, , , and whose types have been declared.

3.1 Start-Tags, End-Tags, and Empty-Element Tags

[Definition: The beginning of every non-empty XML element is marked by a start-tag.]

Start-tag[40]   <!-- declarations for <head> & <body> -->70   ::=   <!-- declarations for <head> & <body> -->71[41]   <!-- declarations for <head> & <body> -->72   ::=   <!-- declarations for <head> & <body> -->73

The in the start- and end-tags gives the element's type. [Definition: The - pairs are referred to as the attribute specifications of the element], [Definition: with the in each pair referred to as the attribute name ] and [Definition: the content of the (the text between the <!-- declarations for <head> & <body> -->74 or <!-- declarations for <head> & <body> -->75 delimiters) as the attribute value.] Note that the order of attribute specifications in a start-tag or empty-element tag is not significant.

Well-formedness constraint: Unique Att Spec

An attribute name MUST NOT appear more than once in the same start-tag or empty-element tag.

Validity constraint: Attribute Value Type

The attribute MUST have been declared; the value MUST be of the type declared for it. (For attribute types, see .)

Well-formedness constraint: No External Entity References

Attribute values MUST NOT contain direct or indirect entity references to external entities.

Well-formedness constraint: No <?xml version="1.0" standalone='yes'?>3 in Attribute Values

The of any entity referred to directly or indirectly in an attribute value MUST NOT contain a <?xml version="1.0" standalone='yes'?>3.

An example of a start-tag:

<!-- declarations for <head> & <body> -->3

[Definition: The end of every element that begins with a start-tag MUST be marked by an end-tag containing a name that echoes the element's type as given in the start-tag:]

End-tag[42]   <!-- declarations for <head> & <body> -->78   ::=   <!-- declarations for <head> & <body> -->79

An example of an end-tag:

<!-- declarations for <head> & <body> -->4

[Definition: The between the start-tag and end-tag is called the element's content:]

Content of Elements[43]   <!-- declarations for <head> & <body> -->80   ::=   <!-- declarations for <head> & <body> -->81

[Definition: An element with no is said to be empty.] The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. [Definition: An empty-element tag takes a special form:]

Tags for Empty Elements[44]   <!-- declarations for <head> & <body> -->82   ::=   <!-- declarations for <head> & <body> -->83

Empty-element tags may be used for any element which has no content, whether or not it is declared using the keyword EMPTY. , the empty-element tag SHOULD be used, and SHOULD only be used, for elements which are declared EMPTY.

Examples of empty elements:

<!-- declarations for <head> & <body> -->5

3.2 Element Type Declarations

The structure of an may, for purposes, be constrained using element type and attribute-list declarations. An element type declaration constrains the element's .

Element type declarations often constrain which element types can appear as of the element. At user option, an XML processor MAY issue a warning when a declaration mentions an element type for which no declaration is provided, but this is not an error.

[Definition: An element type declaration takes the form:]

Element Type Declaration[45]   <!-- declarations for <head> & <body> -->84   ::=   <!-- declarations for <head> & <body> -->85[46]   <!-- declarations for <head> & <body> -->86   ::=   <!-- declarations for <head> & <body> -->87

where the gives the element type being declared.

Validity constraint: Unique Element Type Declaration

An element type MUST NOT be declared more than once.

Examples of element type declarations:

<!-- declarations for <head> & <body> -->6

3.2.1 Element Content

[Definition: An element has element content when elements of that type MUST contain only elements (no character data), optionally separated by white space (characters matching the nonterminal ).] [Definition: In this case, the constraint includes a content model, a simple grammar governing the allowed types of the child elements and the order in which they are allowed to appear.] The grammar is built on content particles (s), which consist of names, choice lists of content particles, or sequence lists of content particles:

Element-content Models[47]   <!-- declarations for <head> & <body> -->88   ::=   <!-- declarations for <head> & <body> -->89[48]   <!-- declarations for <head> & <body> -->90   ::=   <!-- declarations for <head> & <body> -->91[49]   <!-- declarations for <head> & <body> -->92   ::=   <!-- declarations for <head> & <body> -->93[50]   <!-- declarations for <head> & <body> -->94   ::=   <!-- declarations for <head> & <body> -->95

where each is the type of an element which may appear as a . Any content particle in a choice list may appear in the at the location where the choice list appears in the grammar; content particles occurring in a sequence list MUST each appear in the in the order given in the list. The optional character following a name or list governs whether the element or the content particles in the list may occur one or more (<!-- declarations for <head> & <body> -->96), zero or more (<!-- declarations for <head> & <body> -->97), or zero or one times (<!-- declarations for <head> & <body> -->98). The absence of such an operator means that the element or content particle MUST appear exactly once. This syntax and meaning are identical to those used in the productions in this specification.

The content of an element matches a content model if and only if it is possible to trace out a path through the content model, obeying the sequence, choice, and repetition operators and matching each element in the content against an element type in the content model. , it is an error if the content model allows an element to match more than one occurrence of an element type in the content model. For more information, see .

Validity constraint: Proper Group/PE Nesting

Parameter-entity MUST be properly nested with parenthesized groups. That is to say, if either of the opening or closing parentheses in a , , or construct is contained in the replacement text for a , both MUST be contained in the same replacement text.

, if a parameter-entity reference appears in a , , or construct, its replacement text SHOULD contain at least one non-blank character, and neither the first nor last non-blank character of the replacement text SHOULD be a connector (<!-- declarations for <head> & <body> -->99 or <!-- B+, B, or B--->00).

Examples of element-content models:

<!-- declarations for <head> & <body> -->7

3.2.2 Mixed Content

[Definition: An element has mixed content when elements of that type may contain character data, optionally interspersed with elements.] In this case, the types of the child elements may be constrained, but not their order or their number of occurrences:

Mixed-content Declaration[51]   <!-- B+, B, or B--->01   ::=   <!-- B+, B, or B--->02<!-- B+, B, or B--->03

where the s give the types of elements that may appear as children. The keyword #PCDATA derives historically from the term "parsed character data."

Validity constraint: No Duplicate Types

The same name MUST NOT appear more than once in a single mixed-content declaration.

Examples of mixed content declarations:

<!-- declarations for <head> & <body> -->8

3.3 Attribute-List Declarations

are used to associate name-value pairs with . Attribute specifications MUST NOT appear outside of and ; thus, the productions used to recognize them appear in . Attribute-list declarations may be used:

  • To define the set of attributes pertaining to a given element type.

  • To establish type constraints for these attributes.

  • To provide for attributes.

[Definition: Attribute-list declarations specify the name, data type, and default value (if any) of each attribute associated with a given element type:]

Attribute-list Declaration[52]   <!-- B+, B, or B--->04   ::=   <!-- B+, B, or B--->05[53]   <!-- B+, B, or B--->06   ::=   <!-- B+, B, or B--->07

The in the rule is the type of an element. At user option, an XML processor MAY issue a warning if attributes are declared for an element type not itself declared, but this is not an error. The in the rule is the name of the attribute.

When more than one is provided for a given element type, the contents of all those provided are merged. When more than one definition is provided for the same attribute of a given element type, the first declaration is binding and later declarations are ignored. writers of DTDs may choose to provide at most one attribute-list declaration for a given element type, at most one attribute definition for a given attribute name in an attribute-list declaration, and at least one attribute definition in each attribute-list declaration. For interoperability, an XML processor MAY at user option issue a warning when more than one attribute-list declaration is provided for a given element type, or more than one attribute definition is provided for a given attribute, but this is not an error.

3.3.1 Attribute Types

XML attribute types are of three kinds: a string type, a set of tokenized types, and enumerated types. The string type may take any literal string as a value; the tokenized types are more constrained. The validity constraints noted in the grammar are applied after the attribute value has been normalized as described in .

Attribute Types[54]   <!-- B+, B, or B--->08   ::=   <!-- B+, B, or B--->09[55]   <!-- B+, B, or B--->10   ::=   <!-- B+, B, or B--->11[56]   <!-- B+, B, or B--->12   ::=   <!-- B+, B, or B--->13<!-- B+, B, or B--->14<!-- B+, B, or B--->15<!-- B+, B, or B--->16<!-- B+, B, or B--->17<!-- B+, B, or B--->18<!-- B+, B, or B--->19

Validity constraint: ID

Values of type ID MUST match the production. A name MUST NOT appear more than once in an XML document as a value of this type; i.e., ID values MUST uniquely identify the elements which bear them.

Validity constraint: One ID per Element Type

An element type MUST NOT have more than one ID attribute specified.

Validity constraint: ID Attribute Default

An ID attribute MUST have a declared default of #IMPLIED or #REQUIRED.

Validity constraint: IDREF

Values of type IDREF MUST match the production, and values of type IDREFS MUST match ; each MUST match the value of an ID attribute on some element in the XML document; i.e. IDREF values MUST match the value of some ID attribute.

Validity constraint: Entity Name

Values of type ENTITY MUST match the production, values of type ENTITIES MUST match ; each MUST match the name of an declared in the .

Validity constraint: Name Token

Values of type NMTOKEN MUST match the production; values of type NMTOKENS MUST match .

[Definition: Enumerated attributes have a list of allowed values in their declaration ]. They MUST take one of those values. There are two kinds of enumerated attribute types:

Enumerated Attribute Types[57]   <!-- B+, B, or B--->20   ::=   <!-- B+, B, or B--->21[58]   <!-- B+, B, or B--->22   ::=   <!-- B+, B, or B--->23[59]   <!-- B+, B, or B--->24   ::=   <!-- B+, B, or B--->25

A NOTATION attribute identifies a , declared in the DTD with associated system and/or public identifiers, to be used in interpreting the element to which the attribute is attached.

Validity constraint: Notation Attributes

Values of this type MUST match one of the names included in the declaration; all notation names in the declaration MUST be declared.

Validity constraint: One Notation Per Element Type

An element type MUST NOT have more than one NOTATION attribute specified.

Validity constraint: No Notation on Empty Element

, an attribute of type NOTATION MUST NOT be declared on an element declared EMPTY.

Validity constraint: No Duplicate Tokens

The notation names in a single attribute declaration, as well as the s in a single attribute declaration, MUST all be distinct.

Validity constraint: Enumeration

Values of this type MUST match one of the tokens in the declaration.

the same SHOULD NOT occur more than once in the enumerated attribute types of a single element type.

3.3.2 Attribute Defaults

An provides information on whether the attribute's presence is REQUIRED, and if not, how an XML processor is to react if a declared attribute is absent in a document.

Attribute Defaults[60]   <!-- B+, B, or B--->26   ::=   <!-- B+, B, or B--->27<!-- B+, B, or B--->28

In an attribute declaration, #REQUIRED means that the attribute MUST always be provided, #IMPLIED that no default value is provided. [Definition: If the declaration is neither #REQUIRED nor #IMPLIED, then the value contains the declared default value; the #FIXED keyword states that the attribute MUST always have the default value. When an XML processor encounters an element without a specification for an attribute for which it has read a default value declaration, it MUST report the attribute with the declared default value to the application.]

Validity constraint: Required Attribute

If the default declaration is the keyword #REQUIRED, then the attribute MUST be specified for all elements of the type in the attribute-list declaration.

Validity constraint: Attribute Default Value Syntactically Correct

The declared default value MUST meet the syntactic constraints of the declared attribute type. That is, the default value of an attribute:

  • of type IDREF or ENTITY must match the production;

  • of type IDREFS or ENTITIES must match the production;

  • of type NMTOKEN must match the production;

  • of type NMTOKENS must match the production;

  • of an (either a type or an ) must match one of the enumerated values.

Note that only the syntactic constraints of the type are required here; other constraints (e.g. that the value be the name of a declared unparsed entity, for an attribute of type ENTITY) will be reported by a validating parser only if an element without a specification for this attribute actually occurs.

Validity constraint: Fixed Attribute Default

If an attribute has a default value declared with the #FIXED keyword, instances of that attribute MUST match the default value.

Examples of attribute-list declarations:

<!-- declarations for <head> & <body> -->9

3.3.3 Attribute-Value Normalization

Before the value of an attribute is passed to the application or checked for validity, the XML processor MUST normalize the attribute value by applying the algorithm below, or by using some other method such that the value passed to the application is the same as that produced by the algorithm.

  1. All line breaks MUST have been normalized on input to #xA as described in , so the rest of this algorithm operates on text normalized in this way.

  2. Begin with a normalized value consisting of the empty string.

  3. For each character, entity reference, or character reference in the unnormalized attribute value, beginning with the first and continuing to the last, do the following:

    • For a character reference, append the referenced character to the normalized value.

    • For an entity reference, recursively apply step 3 of this algorithm to the replacement text of the entity.

    • For a white space character (#x20, #xD, #xA, #x9), append a space character (#x20) to the normalized value.

    • For another character, append the character to the normalized value.

If the attribute type is not CDATA, then the XML processor MUST further process the normalized attribute value by discarding any leading and trailing space (#x20) characters, and by replacing sequences of space (#x20) characters by a single space (#x20) character.

Note that if the unnormalized attribute value contains a character reference to a white space character other than space (#x20), the normalized value contains the referenced character itself (#xD, #xA or #x9). This contrasts with the case where the unnormalized value contains a white space character (not a reference), which is replaced with a space character (#x20) in the normalized value and also contrasts with the case where the unnormalized value contains an entity reference whose replacement text contains a white space character; being recursively processed, the white space character is replaced with a space character (#x20) in the normalized value.

All attributes for which no declaration has been read SHOULD be treated by a non-validating processor as if declared CDATA.

It is an error if an contains a to an entity for which no declaration has been read.

Following are examples of attribute normalization. Given the following declarations:

<!-- B+, B, or B--->0

the attribute specifications in the left column below would be normalized to the character sequences of the middle column if the attribute <!-- B+, B, or B--->29 is declared NMTOKENS and to those of the right columns if <!-- B+, B, or B--->29 is declared CDATA.

Attribute specificationa is NMTOKENSa is CDATA

<!-- B+, B, or B--->1

<!-- B+, B, or B--->2

<!-- B+, B, or B--->3

<!-- B+, B, or B--->4

<!-- B+, B, or B--->5

<!-- B+, B, or B--->6

<!-- B+, B, or B--->7

<!-- B+, B, or B--->8

<!-- B+, B, or B--->8

Note that the last example is invalid (but well-formed) if <!-- B+, B, or B--->29 is declared to be of type NMTOKENS.

3.4 Conditional Sections

[Definition: Conditional sections are portions of the or of external parameter entities which are included in, or excluded from, the logical structure of the DTD based on the keyword which governs them.]

Conditional Section[61]   <!-- B+, B, or B--->32   ::=   <!-- B+, B, or B--->33[62]   <!-- B+, B, or B--->34   ::=   <!-- B+, B, or B--->35[63]   <!-- B+, B, or B--->36   ::=   <!-- B+, B, or B--->37[64]   <!-- B+, B, or B--->38   ::=   <!-- B+, B, or B--->39[65]   <!-- B+, B, or B--->40   ::=   <!-- B+, B, or B--->41

Validity constraint: Proper Conditional Section/PE Nesting

If any of the "<!-- B+, B, or B--->42", "<!-- B+, B, or B--->43", or "<?xml version="1.0" standalone='yes'?>9" of a conditional section is contained in the replacement text for a parameter-entity reference, all of them MUST be contained in the same replacement text.

Like the internal and external DTD subsets, a conditional section may contain one or more complete declarations, comments, processing instructions, or nested conditional sections, intermingled with white space.

If the keyword of the conditional section is INCLUDE, then the contents of the conditional section MUST be processed as part of the DTD. If the keyword of the conditional section is IGNORE, then the contents of the conditional section MUST NOT be processed as part of the DTD. If a conditional section with a keyword of INCLUDE occurs within a larger conditional section with a keyword of IGNORE, both the outer and the inner conditional sections MUST be ignored. The contents of an ignored conditional section MUST be parsed by ignoring all characters after the "<!-- B+, B, or B--->43" following the keyword, except conditional section starts "<!-- B+, B, or B--->42" and ends "<?xml version="1.0" standalone='yes'?>9", until the matching conditional section end is found. Parameter entity references MUST NOT be recognized in this process.

If the keyword of the conditional section is a parameter-entity reference, the parameter entity MUST be replaced by its content before the processor decides whether to include or ignore the conditional section.

An example:

<![CDATA[<greeting>Hello, world!</greeting>]]> 0

4 Physical Structures

[Definition: An XML document may consist of one or many storage units. These are called entities; they all have content and are all (except for the and the ) identified by entity name.] Each XML document has one entity called the , which serves as the starting point for the and may contain the whole document.

Entities may be either parsed or unparsed. [Definition: The contents of a parsed entity are referred to as its ; this is considered an integral part of the document.]

[Definition: An unparsed entity is a resource whose contents may or may not be , and if text, may be other than XML. Each unparsed entity has an associated , identified by name. Beyond a requirement that an XML processor make the identifiers for the entity and notation available to the application, XML places no constraints on the contents of unparsed entities.]

Parsed entities are invoked by name using entity references; unparsed entities by name, given in the value of ENTITY or ENTITIES attributes.

[Definition: General entities are entities for use within the document content. In this specification, general entities are sometimes referred to with the unqualified term entity when this leads to no ambiguity.] [Definition: Parameter entities are parsed entities for use within the DTD.] These two types of entities use different forms of reference and are recognized in different contexts. Furthermore, they occupy different namespaces; a parameter entity and a general entity with the same name are two distinct entities.

4.1 Character and Entity References

[Definition: A character reference refers to a specific character in the ISO/IEC 10646 character set, for example one not directly accessible from available input devices.]

Character Reference[66]   <!-- B+, B, or B--->48   ::=   <!-- B+, B, or B--->49<!-- B+, B, or B--->50

Well-formedness constraint: Legal Character

Characters referred to using character references MUST match the production for .

If the character reference begins with " <!-- B+, B, or B--->51 ", the digits and letters up to the terminating <!-- B+, B, or B--->52 provide a hexadecimal representation of the character's code point in ISO/IEC 10646. If it begins just with " <!-- B+, B, or B--->53 ", the digits up to the terminating <!-- B+, B, or B--->52 provide a decimal representation of the character's code point.

[Definition: An entity reference refers to the content of a named entity.] [Definition: References to parsed general entities use ampersand (<!-- B+, B, or B--->55) and semicolon (<!-- B+, B, or B--->52) as delimiters.] [Definition: Parameter-entity references use percent-sign (<!-- B+, B, or B--->57) and semicolon (<!-- B+, B, or B--->52) as delimiters.]

Entity Reference[67]   <!-- B+, B, or B--->59   ::=   <!-- B+, B, or B--->60[68]   <!-- B+, B, or B--->61   ::=   <!-- B+, B, or B--->62[69]   <!-- B+, B, or B--->63   ::=   <!-- B+, B, or B--->64

Well-formedness constraint: Entity Declared

In a document without any DTD, a document with only an internal DTD subset which contains no parameter entity references, or a document with " <!-- B+, B, or B--->65 ", for an entity reference that does not occur within the external subset or a parameter entity, the given in the entity reference MUST that in an that does not occur within the external subset or a parameter entity, except that well-formed documents need not declare any of the following entities: <!-- declarations for <head> & <body> -->48, <!-- declarations for <head> & <body> -->49, <!-- declarations for <head> & <body> -->50, <!-- declarations for <head> & <body> -->51, <!-- declarations for <head> & <body> -->52. The declaration of a general entity MUST precede any reference to it which appears in a default value in an attribute-list declaration.

Note that non-validating processors are read and process entity declarations occurring in parameter entities or in the external subset; for such documents, the rule that an entity must be declared is a well-formedness constraint only if .

Validity constraint: Entity Declared

In a document with an external subset or parameter entity references, if the document is not standalone (either "<!-- B+, B, or B--->71" is specified or there is no standalone declaration), then the given in the entity reference MUST that in an . For interoperability, valid documents SHOULD declare the entities <!-- declarations for <head> & <body> -->48, <!-- declarations for <head> & <body> -->49, <!-- declarations for <head> & <body> -->50, <!-- declarations for <head> & <body> -->51, <!-- declarations for <head> & <body> -->52, in the form specified in . The declaration of a parameter entity MUST precede any reference to it. Similarly, the declaration of a general entity MUST precede any attribute-list declaration containing a default value with a direct or indirect reference to that general entity.

Well-formedness constraint: Parsed Entity

An entity reference MUST NOT contain the name of an . Unparsed entities may be referred to only in declared to be of type ENTITY or ENTITIES.

Well-formedness constraint: No Recursion

A parsed entity MUST NOT contain a recursive reference to itself, either directly or indirectly.

Well-formedness constraint: In DTD

Parameter-entity references MUST NOT appear outside the .

Examples of character and entity references:

<![CDATA[<greeting>Hello, world!</greeting>]]> 1

Example of a parameter-entity reference:

<![CDATA[<greeting>Hello, world!</greeting>]]> 2

4.2 Entity Declarations

[Definition: Entities are declared thus:]

Entity Declaration[70]   <!-- B+, B, or B--->77   ::=   <!-- B+, B, or B--->78[71]   <!-- B+, B, or B--->79   ::=   <!-- B+, B, or B--->80[72]   <!-- B+, B, or B--->81   ::=   <!-- B+, B, or B--->82[73]   <!-- B+, B, or B--->83   ::=   <!-- B+, B, or B--->84[74]   <!-- B+, B, or B--->85   ::=   <!-- B+, B, or B--->86

The identifies the entity in an or, in the case of an unparsed entity, in the value of an ENTITY or ENTITIES attribute. If the same entity is declared more than once, the first declaration encountered is binding; at user option, an XML processor MAY issue a warning if entities are declared multiple times.

4.2.1 Internal Entities

[Definition: If the entity definition is an , the defined entity is called an internal entity. There is no separate physical storage object, and the content of the entity is given in the declaration.] Note that some processing of entity and character references in the may be required to produce the correct : see .

An internal entity is a .

Example of an internal entity declaration:

<![CDATA[<greeting>Hello, world!</greeting>]]> 3

4.2.2 External Entities

[Definition: If the entity is not internal, it is an external entity, declared as follows:]

External Entity Declaration[75]   <!-- B+, B, or B--->87   ::=   <!-- B+, B, or B--->88<!-- B+, B, or B--->89[76]   <!-- B+, B, or B--->90   ::=   <!-- B+, B, or B--->91

If the is present, this is a general ; otherwise it is a parsed entity.

Validity constraint: Notation Declared

The MUST match the declared name of a .

[Definition: The is called the entity's system identifier. It is meant to be converted to a URI reference (as defined in ), as part of the process of dereferencing it to obtain input for the XML processor to construct the entity's replacement text.] It is an error for a fragment identifier (beginning with a <!-- B+, B, or B--->92 character) to be part of a system identifier. Unless otherwise provided by information outside the scope of this specification (e.g. a special XML element type defined by a particular DTD, or a processing instruction defined by a particular application specification), relative URIs are relative to the location of the resource within which the entity declaration occurs. This is defined to be the external entity containing the '<' which starts the declaration, at the point when it is parsed as a declaration. A URI might thus be relative to the , to the entity containing the , or to some other . Attempts to retrieve the resource identified by a URI may be redirected at the parser level (for example, in an entity resolver) or below (at the protocol level, for example, via an HTTP <!-- B+, B, or B--->93 header). In the absence of additional information outside the scope of this specification within the resource, the base URI of a resource is always the URI of the actual resource returned. In other words, it is the URI of the resource retrieved after all redirection has occurred.

System identifiers (and other XML strings meant to be used as URI references) may contain characters that, according to , must be escaped before a URI can be used to retrieve the referenced resource. The characters to be escaped are the control characters #x0 to #x1F and #x7F (most of which cannot appear in XML), space #x20, the delimiters '<' #x3C, '>' #x3E and '"' #x22, the unwise characters '{' #x7B, '}' #x7D, '|' #x7C, '\' #x5C, '^' #x5E and '`' #x60, as well as all characters above #x7F. Since escaping is not always a fully reversible process, it MUST be performed only when absolutely necessary and as late as possible in a processing chain. In particular, neither the process of converting a relative URI to an absolute one nor the process of passing a URI reference to a process or software component responsible for dereferencing it SHOULD trigger escaping. When escaping does occur, it MUST be performed as follows:

  1. Each character to be escaped is represented in UTF-8 as one or more bytes.

  2. The resulting bytes are escaped with the URI escaping mechanism (that is, converted to <!-- B+, B, or B--->57 HH, where HH is the hexadecimal notation of the byte value).

  3. The original character is replaced by the resulting character sequence.

Note:

In a future edition of this specification, the XML Core Working Group intends to replace the preceding paragraph and list of steps with a normative reference to an upcoming revision of IETF RFC 3987, which will define "Legacy Extended IRIs (LEIRIs)". When this revision is available, it is the intent of the XML Core WG to use it to replace language similar to the above in any future revisions of XML-related specifications under its purview.

[Definition: In addition to a system identifier, an external identifier may include a public identifier.] An XML processor attempting to retrieve the entity's content may use any combination of the public and system identifiers as well as additional information outside the scope of this specification to try to generate an alternative URI reference. If the processor is unable to do so, it MUST use the URI reference specified in the system literal. Before a match is attempted, all strings of white space in the public identifier MUST be normalized to single space characters (#x20), and leading and trailing white space MUST be removed.

Examples of external entity declarations:

<![CDATA[<greeting>Hello, world!</greeting>]]> 4

4.3 Parsed Entities

4.3.1 The Text Declaration

External parsed entities SHOULD each begin with a text declaration.

Text Declaration[77]   <!-- B+, B, or B--->95   ::=   <!-- B+, B, or B--->96

The text declaration MUST be provided literally, not by reference to a parsed entity. The text declaration MUST NOT appear at any position other than the beginning of an external parsed entity. The text declaration in an external parsed entity is not considered part of its .

4.3.2 Well-Formed Parsed Entities

The document entity is well-formed if it matches the production labeled . An external general parsed entity is well-formed if it matches the production labeled . All external parameter entities are well-formed by definition.

Note:

Only parsed entities that are referenced directly or indirectly within the document are required to be well-formed.

Well-Formed External Parsed Entity[78]   <!-- B+, B, or B--->97   ::=   <!-- B+, B, or B--->98

An internal general parsed entity is well-formed if its replacement text matches the production labeled . All internal parameter entities are well-formed by definition.

A consequence of well-formedness in general entities is that the logical and physical structures in an XML document are properly nested; no , , , , , , , or can begin in one entity and end in another.

4.3.3 Character Encoding in Entities

Each external parsed entity in an XML document may use a different encoding for its characters. All XML processors MUST be able to read entities in both the UTF-8 and UTF-16 encodings. The terms "UTF-8" and "UTF-16" in this specification do not apply to related character encodings, including but not limited to UTF-16BE, UTF-16LE, or CESU-8.

Entities encoded in UTF-16 MUST and entities encoded in UTF-8 MAY begin with the Byte Order Mark described by Annex H of , section 16.8 of (the ZERO WIDTH NO-BREAK SPACE character, #xFEFF). This is an encoding signature, not part of either the markup or the character data of the XML document. XML processors MUST be able to use this character to differentiate between UTF-8 and UTF-16 encoded documents.

If the replacement text of an external entity is to begin with the character U+FEFF, and no text declaration is present, then a Byte Order Mark MUST be present, whether the entity is encoded in UTF-8 or UTF-16.

Although an XML processor is required to read only entities in the UTF-8 and UTF-16 encodings, it is recognized that other encodings are used around the world, and it may be desired for XML processors to read entities that use them. In the absence of external character encoding information (such as MIME headers), parsed entities which are stored in an encoding other than UTF-8 or UTF-16 MUST begin with a text declaration (see ) containing an encoding declaration:

Encoding Declaration[80]   <!-- B+, B, or B--->99   ::=   <![CDATA[<greeting>Hello, world!</greeting>]]> 00[81]   <![CDATA[<greeting>Hello, world!</greeting>]]> 01   ::=   <![CDATA[<greeting>Hello, world!</greeting>]]> 02/* Encoding name contains only Latin characters */

In the , the encoding declaration is part of the . The is the name of the encoding used.

In an encoding declaration, the values " <![CDATA[<greeting>Hello, world!</greeting>]]> 03 ", " <![CDATA[<greeting>Hello, world!</greeting>]]> 04 ", " <![CDATA[<greeting>Hello, world!</greeting>]]> 05 ", and " <![CDATA[<greeting>Hello, world!</greeting>]]> 06 " SHOULD be used for the various encodings and transformations of Unicode / ISO/IEC 10646, the values " <![CDATA[<greeting>Hello, world!</greeting>]]> 07 ", " <![CDATA[<greeting>Hello, world!</greeting>]]> 08 ", ... " <![CDATA[<greeting>Hello, world!</greeting>]]> 09 n " (where n is the part number) SHOULD be used for the parts of ISO 8859, and the values " <![CDATA[<greeting>Hello, world!</greeting>]]> 10 ", " <![CDATA[<greeting>Hello, world!</greeting>]]> 11 ", and " <![CDATA[<greeting>Hello, world!</greeting>]]> 12 " SHOULD be used for the various encoded forms of JIS X-0208-1997. It is RECOMMENDED that character encodings registered (as charsets) with the Internet Assigned Numbers Authority , other than those just listed, be referred to using their registered names; other encodings SHOULD use names starting with an "x-" prefix. XML processors SHOULD match character encoding names in a case-insensitive way and SHOULD either interpret an IANA-registered name as the encoding registered at IANA for that name or treat it as unknown (processors are, of course, not required to support all IANA-registered encodings).

In the absence of information provided by an external transport protocol (e.g. HTTP or MIME), it is a for an entity including an encoding declaration to be presented to the XML processor in an encoding other than that named in the declaration, or for an entity which begins with neither a Byte Order Mark nor an encoding declaration to use an encoding other than UTF-8. Note that since ASCII is a subset of UTF-8, ordinary ASCII entities do not strictly need an encoding declaration.

It is a for a to occur other than at the beginning of an external entity.

It is a when an XML processor encounters an entity with an encoding that it is unable to process. It is a if an XML entity is determined (via default, encoding declaration, or higher-level protocol) to be in a certain encoding but contains byte sequences that are not legal in that encoding. Specifically, it is a fatal error if an entity encoded in UTF-8 contains any ill-formed code unit sequences, as defined in section 3.9 of Unicode . Unless an encoding is determined by a higher-level protocol, it is also a if an XML entity contains no encoding declaration and its content is not legal UTF-8 or UTF-16.

Examples of text declarations containing encoding declarations:

<![CDATA[<greeting>Hello, world!</greeting>]]> 5

4.4 XML Processor Treatment of Entities and References

The table below summarizes the contexts in which character references, entity references, and invocations of unparsed entities might appear and the REQUIRED behavior of an in each case. The labels in the leftmost column describe the recognition context:

Reference in Content

as a reference anywhere after the and before the of an element; corresponds to the nonterminal .

Reference in Attribute Value

as a reference within either the value of an attribute in a , or a default value in an ; corresponds to the nonterminal .

Occurs as Attribute Value

as a , not a reference, appearing either as the value of an attribute which has been declared as type ENTITY, or as one of the space-separated tokens in the value of an attribute which has been declared as type ENTITIES.

Reference in Entity Value

as a reference within a parameter or internal entity's in the entity's declaration; corresponds to the nonterminal .

Reference in DTD

as a reference within either the internal or external subsets of the , but outside of an , , , , , , or the contents of an ignored conditional section (see ).

.

Entity TypeCharacterParameterInternal GeneralExternal Parsed GeneralUnparsedReference in ContentReference in Attribute ValueOccurs as Attribute ValueReference in EntityValueReference in DTD

4.4.1 Not Recognized

Outside the DTD, the <!-- B+, B, or B--->57 character has no special significance; thus, what would be parameter entity references in the DTD are not recognized as markup in . Similarly, the names of unparsed entities are not recognized except when they appear in the value of an appropriately declared attribute.

4.4.2 Included

[Definition: An entity is included when its is retrieved and processed, in place of the reference itself, as though it were part of the document at the location the reference was recognized.] The replacement text may contain both and (except for parameter entities) , which MUST be recognized in the usual way. (The string " <![CDATA[<greeting>Hello, world!</greeting>]]> 14 " expands to " <![CDATA[<greeting>Hello, world!</greeting>]]> 15 " and the remaining ampersand is not recognized as an entity-reference delimiter.) A character reference is included when the indicated character is processed in place of the reference itself.

4.4.3 Included If Validating

When an XML processor recognizes a reference to a parsed entity, in order to the document, the processor MUST its replacement text. If the entity is external, and the processor is not attempting to validate the XML document, the processor MAY, but need not, include the entity's replacement text. If a non-validating processor does not include the replacement text, it MUST inform the application that it recognized, but did not read, the entity.

This rule is based on the recognition that the automatic inclusion provided by the SGML and XML entity mechanism, primarily designed to support modularity in authoring, is not necessarily appropriate for other applications, in particular document browsing. Browsers, for example, when encountering an external parsed entity reference, might choose to provide a visual indication of the entity's presence and retrieve it for display only on demand.

4.4.4 Forbidden

The following are forbidden, and constitute :

  • the appearance of a reference to an , except in the in an entity declaration.

  • the appearance of any character or general-entity reference in the DTD except within an or .

  • a reference to an external entity in an attribute value.

4.4.5 Included in Literal

When an appears in an attribute value, or a parameter entity reference appears in a literal entity value, its MUST be processed in place of the reference itself as though it were part of the document at the location the reference was recognized, except that a single or double quote character in the replacement text MUST always be treated as a normal data character and MUST NOT terminate the literal. For example, this is well-formed:

<![CDATA[<greeting>Hello, world!</greeting>]]> 6

while this is not:

<![CDATA[<greeting>Hello, world!</greeting>]]> 7

4.4.6 Notify

When the name of an appears as a token in the value of an attribute of declared type ENTITY or ENTITIES, a validating processor MUST inform the application of the and (if any) identifiers for both the entity and its associated .

4.4.7 Bypassed

When a general entity reference appears in the in an entity declaration, it MUST be bypassed and left as is.

4.4.8 Included as PE

Just as with external parsed entities, parameter entities need only be . When a parameter-entity reference is recognized in the DTD and included, its MUST be enlarged by the attachment of one leading and one following space (#x20) character; the intent is to constrain the replacement text of parameter entities to contain an integral number of grammatical tokens in the DTD. This behavior MUST NOT apply to parameter entity references within entity values; these are described in .

4.4.9 Error

It is an for a reference to an unparsed entity to appear in the in an entity declaration.

4.5 Construction of Entity Replacement Text

In discussing the treatment of entities, it is useful to distinguish two forms of the entity's value. [Definition: For an internal entity, the literal entity value is the quoted string actually present in the entity declaration, corresponding to the non-terminal .] [Definition: For an external entity, the literal entity value is the exact text contained in the entity.] [Definition: For an internal entity, the replacement text is the content of the entity, after replacement of character references and parameter-entity references.] [Definition: For an external entity, the replacement text is the content of the entity, after stripping the text declaration (leaving any surrounding whitespace) if there is one but without any replacement of character references or parameter-entity references.]

The literal entity value as given in an internal entity declaration () may contain character, parameter-entity, and general-entity references. Such references MUST be contained entirely within the literal entity value. The actual replacement text that is (or ) as described above MUST contain the replacement text of any parameter entities referred to, and MUST contain the character referred to, in place of any character references in the literal entity value; however, general-entity references MUST be left as-is, unexpanded. For example, given the following declarations:

<![CDATA[<greeting>Hello, world!</greeting>]]> 8

then the replacement text for the entity " <![CDATA[<greeting>Hello, world!</greeting>]]> 16 " is:

<![CDATA[<greeting>Hello, world!</greeting>]]> 9

The general-entity reference " <![CDATA[<greeting>Hello, world!</greeting>]]> 17 " would be expanded should the reference " <![CDATA[<greeting>Hello, world!</greeting>]]> 18 " appear in the document's content or an attribute value.

These simple rules may have complex interactions; for a detailed discussion of a difficult example, see .

4.6 Predefined Entities

[Definition: Entity and character references may both be used to escape the left angle bracket, ampersand, and other delimiters. A set of general entities (<!-- declarations for <head> & <body> -->48, <!-- declarations for <head> & <body> -->49, <!-- declarations for <head> & <body> -->50, <!-- declarations for <head> & <body> -->51, <!-- declarations for <head> & <body> -->52) is specified for this purpose. Numeric character references may also be used; they are expanded immediately when recognized and MUST be treated as character data, so the numeric character references " <![CDATA[<greeting>Hello, world!</greeting>]]> 24 " and " <![CDATA[<greeting>Hello, world!</greeting>]]> 25 " may be used to escape <?xml version="1.0" standalone='yes'?>3 and <!-- B+, B, or B--->55 when they occur in character data.]

All XML processors MUST recognize these entities whether they are declared or not. , valid XML documents SHOULD declare these entities, like any others, before using them. If the entities <!-- declarations for <head> & <body> -->49 or <!-- declarations for <head> & <body> -->48 are declared, they MUST be declared as internal entities whose replacement text is a character reference to the respective character (less-than sign or ampersand) being escaped; the double escaping is REQUIRED for these entities so that references to them produce a well-formed result. If the entities <!-- declarations for <head> & <body> -->50, <!-- declarations for <head> & <body> -->51, or <!-- declarations for <head> & <body> -->52 are declared, they MUST be declared as internal entities whose replacement text is the single character being escaped (or a character reference to that character; the double escaping here is OPTIONAL but harmless). For example:

<?xml version="1.0"?> <greeting>Hello, world!</greeting> 0

4.7 Notation Declarations

[Definition: Notations identify by name the format of , the format of elements which bear a notation attribute, or the application to which a is addressed.]

[Definition: Notation declarations provide a name for the notation, for use in entity and attribute-list declarations and in attribute specifications, and an external identifier for the notation which may allow an XML processor or its client application to locate a helper application capable of processing data in the given notation.]

Notation Declarations[82]   <![CDATA[<greeting>Hello, world!</greeting>]]> 33   ::=   <![CDATA[<greeting>Hello, world!</greeting>]]> 34[83]   <![CDATA[<greeting>Hello, world!</greeting>]]> 35   ::=   <![CDATA[<greeting>Hello, world!</greeting>]]> 36

Validity constraint: Unique Notation Name

A given MUST NOT be declared in more than one notation declaration.

XML processors MUST provide applications with the name and external identifier(s) of any notation declared and referred to in an attribute value, attribute definition, or entity declaration. They MAY additionally resolve the external identifier into the , file name, or other information needed to allow the application to call a processor for data in the notation described. (It is not an error, however, for XML documents to declare and refer to notations for which notation-specific applications are not available on the system where the XML processor or application is running.)

4.8 Document Entity

[Definition: The document entity serves as the root of the entity tree and a starting-point for an .] This specification does not specify how the document entity is to be located by an XML processor; unlike other entities, the document entity has no name and might well appear on a processor input stream without any identification at all.

5 Conformance

5.1 Validating and Non-Validating Processors

Conforming fall into two classes: validating and non-validating.

Validating and non-validating processors alike MUST report violations of this specification's well-formedness constraints in the content of the and any other that they read.

[Definition: Validating processors MUST, at user option, report violations of the constraints expressed by the declarations in the , and failures to fulfill the validity constraints given in this specification.] To accomplish this, validating XML processors MUST read and process the entire DTD and all external parsed entities referenced in the document.

Non-validating processors are REQUIRED to check only the , including the entire internal DTD subset, for well-formedness. [Definition: While they are not required to check the document for validity, they are REQUIRED to process all the declarations they read in the internal DTD subset and in any parameter entity that they read, up to the first reference to a parameter entity that they do not read; that is to say, they MUST use the information in those declarations to attribute values, the replacement text of internal entities, and supply .] Except when <![CDATA[<greeting>Hello, world!</greeting>]]> 37, they MUST NOT or encountered after a reference to a parameter entity that is not read, since the entity may have contained overriding declarations; when <![CDATA[<greeting>Hello, world!</greeting>]]> 37, processors MUST process these declarations.

Note that when processing invalid documents with a non-validating processor the application may not be presented with consistent information. For example, several requirements for uniqueness within the document may not be met, including more than one element with the same id, duplicate declarations of elements or notations with the same name, etc. In these cases the behavior of the parser with respect to reporting such information to the application is undefined.

5.2 Using XML Processors

The behavior of a validating XML processor is highly predictable; it must read every piece of a document and report all well-formedness and validity violations. Less is required of a non-validating processor; it need not read any part of the document other than the document entity. This has two effects that may be important to users of XML processors:

  • Certain well-formedness errors, specifically those that require reading external entities, may fail to be detected by a non-validating processor. Examples include the constraints entitled , , and , as well as some of the cases described as in .

  • The information passed from the processor to the application may vary, depending on whether the processor reads parameter and external entities. For example, a non-validating processor may fail to attribute values, the replacement text of internal entities, or supply , where doing so depends on having read declarations in external or parameter entities, or in the internal subset after an unread parameter entity reference.

For maximum reliability in interoperating between different XML processors, applications which use non-validating processors SHOULD NOT rely on any behaviors not required of such processors. Applications which require DTD facilities not related to validation (such as the declaration of default attributes and internal entities that are or may be specified in external entities) SHOULD use validating XML processors.

6 Notation

The formal grammar of XML is given in this specification using a simple Extended Backus-Naur Form (EBNF) notation. Each rule in the grammar defines one symbol, in the form

<?xml version="1.0"?> <greeting>Hello, world!</greeting> 1

Symbols are written with an initial capital letter if they are the start symbol of a regular language, otherwise with an initial lowercase letter. Literal strings are quoted.

Within the expression on the right-hand side of a rule, the following expressions are used to match strings of one or more characters:

<![CDATA[<greeting>Hello, world!</greeting>]]> 39

where <![CDATA[<greeting>Hello, world!</greeting>]]> 40 is a hexadecimal integer, the expression matches the character whose number (code point) in ISO/IEC 10646 is <![CDATA[<greeting>Hello, world!</greeting>]]> 40. The number of leading zeros in the <![CDATA[<greeting>Hello, world!</greeting>]]> 39 form is insignificant.

<![CDATA[<greeting>Hello, world!</greeting>]]> 43, <![CDATA[<greeting>Hello, world!</greeting>]]> 44

matches any with a value in the range(s) indicated (inclusive).

<![CDATA[<greeting>Hello, world!</greeting>]]> 45, <![CDATA[<greeting>Hello, world!</greeting>]]> 46

matches any with a value among the characters enumerated. Enumerations and ranges can be mixed in one set of brackets.

<![CDATA[<greeting>Hello, world!</greeting>]]> 47, <![CDATA[<greeting>Hello, world!</greeting>]]> 48

matches any with a value outside the range indicated.

<![CDATA[<greeting>Hello, world!</greeting>]]> 49, <![CDATA[<greeting>Hello, world!</greeting>]]> 50

matches any with a value not among the characters given. Enumerations and ranges of forbidden values can be mixed in one set of brackets.

<![CDATA[<greeting>Hello, world!</greeting>]]> 51

matches a literal string that given inside the double quotes.

<![CDATA[<greeting>Hello, world!</greeting>]]> 52

matches a literal string that given inside the single quotes.

These symbols may be combined to match more complex patterns as follows, where <![CDATA[<greeting>Hello, world!</greeting>]]> 53 and <![CDATA[<greeting>Hello, world!</greeting>]]> 54 represent simple expressions:

(<![CDATA[<greeting>Hello, world!</greeting>]]> 55)

<![CDATA[<greeting>Hello, world!</greeting>]]> 55 is treated as a unit and may be combined as described in this list.

<![CDATA[<greeting>Hello, world!</greeting>]]> 57

matches <![CDATA[<greeting>Hello, world!</greeting>]]> 53 or nothing; optional <![CDATA[<greeting>Hello, world!</greeting>]]> 53.

<![CDATA[<greeting>Hello, world!</greeting>]]> 60

matches <![CDATA[<greeting>Hello, world!</greeting>]]> 53 followed by <![CDATA[<greeting>Hello, world!</greeting>]]> 54. This operator has higher precedence than alternation; thus <![CDATA[<greeting>Hello, world!</greeting>]]> 63 is identical to <![CDATA[<greeting>Hello, world!</greeting>]]> 64.

<![CDATA[<greeting>Hello, world!</greeting>]]> 65

matches <![CDATA[<greeting>Hello, world!</greeting>]]> 53 or <![CDATA[<greeting>Hello, world!</greeting>]]> 54.

<![CDATA[<greeting>Hello, world!</greeting>]]> 68

matches any string that matches <![CDATA[<greeting>Hello, world!</greeting>]]> 53 but does not match <![CDATA[<greeting>Hello, world!</greeting>]]> 54.

<![CDATA[<greeting>Hello, world!</greeting>]]> 71

matches one or more occurrences of <![CDATA[<greeting>Hello, world!</greeting>]]> 53. Concatenation has higher precedence than alternation; thus <![CDATA[<greeting>Hello, world!</greeting>]]> 73 is identical to <![CDATA[<greeting>Hello, world!</greeting>]]> 74.

<![CDATA[<greeting>Hello, world!</greeting>]]> 75

matches zero or more occurrences of <![CDATA[<greeting>Hello, world!</greeting>]]> 53. Concatenation has higher precedence than alternation; thus <![CDATA[<greeting>Hello, world!</greeting>]]> 77 is identical to <![CDATA[<greeting>Hello, world!</greeting>]]> 78.

Other notations used in the productions are:

<![CDATA[<greeting>Hello, world!</greeting>]]> 79

comment.

<![CDATA[<greeting>Hello, world!</greeting>]]> 80

well-formedness constraint; this identifies by name a constraint on documents associated with a production.

<![CDATA[<greeting>Hello, world!</greeting>]]> 81

validity constraint; this identifies by name a constraint on documents associated with a production.

Which of the following is a technique used to allow users to interact with a Web page without having to wait for the Web server to reload the Web page?

AJAX supports data exchange with a web server behind the scenes and allows webpages to update asynchronously. This makes it possible to update parts of a particular webpage and display the results to a user quickly, without having to wait to reload the entire page.

What type of device gathers data and converts them into electronic form for use by the computer?

Input devices accept data in a form that the computer can use; they then send the data to the processing unit. The processor, more formally known as the central processing unit (CPU), has the electronic circuitry that manipulates input data into the information people want.

What type of device gathers data and commands from users to be used by the computer?

input device A hardware device used to enter, or input, data (text, images, and sounds) and instructions (user responses and commands) into a computer. Some input devices are keyboards and mice.

What would be a reason for using a workstation rather than a personal computer group of answer choices?

A workstation is more robust than the typical PC, with enhanced specs like a faster CPU and GPU, more memory, increased storage, software certification, and the ability to withstand constant usage. Often they will have a discrete GPU so the CPU does not have to double up on visual tasks.

zusammenhängende Posts

Toplist

Neuester Beitrag

Stichworte