Reference
XML glossary
58 terms, defined in one sentence each and then demonstrated — 114 of the claims below are executed against a real parser on every test run rather than written from memory.
Every term points at where it bites
A definition on its own settles an argument and nothing else. Each page here links to the format, parse error, datatype, XPath function or tool where the term decides whether a document works — and those links are resolved against the real corpora, so none of them can rot.Document syntax · 14
- PrologEverything in a document before the root element's start tag: the XML declaration, any comments or processing instructions, and the document type declaration.
- XML declarationThe optional <?xml version="1.0" encoding="UTF-8"?> at the very start of a document, declaring its version and character encoding.
- Document type declarationThe <!DOCTYPE root …> in the prolog that names the document's root element and points at, or contains, its markup declarations.
- Internal subsetThe markup declarations written inline between square brackets in a DOCTYPE, rather than fetched from an external DTD file.
- CDATA sectionA <![CDATA[ … ]]> block whose contents are treated as literal characters, so < and & inside it start nothing.
- PCDATAParsed character data: text content that the parser scans for markup, so < and & in it have meaning and must be escaped.
- CommentA <!-- … --> block that carries no document content and is not part of any element's text.
- Processing instructionA <?target data?> node carrying instructions for an application, passed through the parser without being interpreted as content.
- Character referenceA &#nnn; or &#xhhhh; escape naming a Unicode code point directly, rather than by an entity name.
- Entity referenceAn &name; reference to an entity, replaced by that entity's replacement text during parsing.
- Predefined entityOne of the five entities every XML parser knows without a declaration: &, <, >, ' and ".
- General entityAn entity declared with <!ENTITY name "text"> whose replacement text is substituted wherever &name; appears in content.
- Parameter entityAn entity declared with <!ENTITY % name "…"> and referenced as %name;, usable only inside markup declarations rather than in document content.
- External entityAn entity whose replacement text lives outside the document, named by a SYSTEM or PUBLIC identifier and fetched when the entity is referenced.
Names and namespaces · 8
- QNameA qualified name: an optional namespace prefix, a colon, and a local name — the form every element and attribute name takes in a namespaced document.
- NCNameA non-colonised name: an XML name with no colon in it, which is what a namespace prefix and a local name each have to be.
- NMTOKENA name token: any string of XML name characters, with no restriction on what it starts with.
- NamespaceA URI that qualifies element and attribute names, so identically-named elements from different vocabularies can coexist in one document.
- Namespace prefixThe short NCName bound to a namespace URI by an xmlns:prefix declaration, used before a colon to qualify names.
- Default namespaceThe namespace declared by a bare xmlns="…", which applies to unprefixed element names on that element and its descendants.
- Expanded nameThe pair of namespace URI and local name that a QName resolves to — what processors actually compare when they match a name.
- Target namespaceThe namespace a schema's declarations belong to, named by the targetNamespace attribute on xs:schema.
Document structure · 9
- ElementThe unit of structure in XML: a start tag, its content, and a matching end tag — or a single self-closing tag when there is no content.
- AttributeA name–value pair on an element's start tag, whose value is always a quoted string.
- Document elementThe single outermost element that contains every other element in the document.
- Mixed contentAn element containing both text and child elements, interleaved — the model prose uses and data rarely does.
- Text nodeA run of character data in the tree, as a node in its own right — the model a query language sees rather than the markup you wrote.
- Empty elementAn element with no content, written either as a self-closing tag or as a start tag immediately followed by its end tag.
- Document orderThe order nodes appear in the serialized document, which is the order node-sets are returned in and the order positional predicates count in.
- Significant whitespaceWhitespace that is part of a document's content, as opposed to indentation a processor may drop.
- Attribute-value normalizationThe parser's rewriting of attribute values before anything sees them: literal tabs, newlines and carriage returns become spaces.
Schemas and validity · 11
- Well-formedA document that obeys XML's syntax rules: one root element, strictly nested tags, quoted attribute values, escaped markup characters.
- ValidA well-formed document that also conforms to a declared grammar — a DTD, an XSD schema or a RELAX NG grammar.
- DTDThe original XML schema language: element and attribute declarations written in their own non-XML syntax, plus the entity declarations nothing else provides.
- XML Schema (XSD)The W3C schema language: a grammar written in XML itself, with datatypes, namespaces and a type system.
- RELAX NGA schema language built around patterns rather than types, expressing repetition, alternation and interleaving far more directly than XSD.
- SchematronA rule-based schema language that asserts XPath conditions about a document, rather than describing its grammar.
- Content modelThe rule saying what an element may contain: which children, in what order, how many times, and whether text is allowed.
- Simple typeA schema type whose values are text with no child elements and no attributes — a string, a number, a date, or a restriction of one.
- Complex typeA schema type for elements that have children, attributes, or both — everything a simple type cannot describe.
- FacetA constraint that narrows a simple type: a length, a range, a regular expression, a list of permitted values.
- Schema locationAn attribute in an instance document pairing a namespace URI with a URL where a schema for it may be found — a hint, not an instruction.
Parsing and processing · 11
- ParserThe component that reads XML text and reports its structure to an application, or reports a fatal error and stops.
- DOMAn API that parses a whole document into a navigable tree in memory, where every node can be reached from any other.
- SAXA streaming API that pushes events at your code — start element, characters, end element — as it reads, without building a tree.
- StAXA streaming API where your code pulls the next event from the parser, rather than the parser pushing events at your code.
- XPathThe expression language for addressing parts of an XML document — the query language inside XSLT, XSD's identity constraints, Schematron and every DOM API.
- XSLTA language for transforming XML into other XML, HTML or text, written as templates that match patterns in the source tree.
- SerializationTurning a document tree back into text — choosing quoting, escaping, empty-element spelling, indentation and encoding.
- Canonicalization (C14N)Rewriting a document into a single normal form — sorted attributes, expanded empty elements, resolved references, no declaration — so that equivalent documents become byte-identical.
- XIncludeA standard way for one document to include another, by placing an xi:include element where the included content should appear.
- XXE (XML external entity attack)An attack in which a submitted document declares an external entity so that a trusting parser reads a local file or makes a request on the attacker's behalf.
- Entity expansion attackA denial of service in which nested entity definitions expand exponentially, turning a few hundred bytes of document into gigabytes of text.
Encoding and characters · 5
- Encoding declarationThe encoding pseudo-attribute in the XML declaration, telling the parser which character encoding the file's bytes are in.
- Byte order markThe optional U+FEFF character at the start of a file, marking the encoding and — in UTF-16 — its byte order.
- UTF-8The default encoding for XML, and the one every conforming parser must support along with UTF-16.
- XML 1.1A revision of XML that widens the legal name characters and permits most control characters as escapes — almost never used, and best avoided.
- Invalid XML characterA code point XML forbids in a document at all — most of the C0 control range — which cannot be included literally or as an escape.
Arrived holding an error message rather than a word? The parse error reference is keyed by what your parser printed.
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.