QName
QNames were introduced by XML namespaces with the aim to serve as a URI reference. QName stands for "qualified name" and defines a valid identifier for elements and attributes. QNames are commonly used to refer to specific elements or attributes within an XML document.
Motivation
Because URI references can be long and can contain banned for Element-/Attributnamen characters, QNames are used to create a mapping from URI and namespace prefix. Through the mapping of URIs can be abbreviated and are thus written comfortable in XML documents (see example)
Formal definition
QNames are defined by the W3C formally as follows:
QName :: = PrefixedName | UnprefixedName PrefixedName :: = prefix ':' LocalPart UnprefixedName :: = LocalPart Prefix :: = NCName LocalPart :: = NCName NCName is defined as follows:
NCName :: = Name - ( Char * ':' char * ) / * An XML Name, minus the ":" * / Name :: = NameStartChar ( NameChar ) * NameStartChar :: = " " | [ AZ] | "_" | [ az] | [# XC0 # XD6 ] | [# XD8 # XF6 ] | [# XF8 # x2FF ] | [# x370 # x37D ] | [# x37F # x1FFF ] | [# X200C # x200D ] | [# x2070 - # x218F ] | [# x2C00 # x2FEF ] | [# X3001 - # xD7FF ] | [# xF900 # xFDCF ] | [# xFDF0 # xFFFD ] | [# X10000 - # xEFFFF ] NameChar :: = NameStartChar | " - " | ". " | [ 0-9] | # XB7 | [# x0300 - # x036F ] | [# x203F - # x2040 ] Char :: = / * any Unicode char, excluding surrogate blocks FFFE and FFFF. * / # x9 | # xA | # xD | [# x20 - # xD7FF ] | [# XE000 # xFFFD ] | [# x10000 - # x10FFFF ] The prefix is used as a placeholder for the namespace and the local part as a local part of the qualified identifier. Local part can be an attribute name or element name.
Example
xml version = '1 .0 '? >