QName

Last updated

A QName, or qualified name, is the fully qualified name of an element, attribute, or identifier in an XML document. A QName concisely associates the URI of an XML namespace with the local name of an element, attribute, or identifier in that namespace. [1] To make this association, the QName assigns the local name a prefix that corresponds to its namespace. In all, the QName comprises the URI of the XML namespace, the prefix, and the local name.

Contents

The World Wide Web Consortium introduced the QName convention in the 1999 specification "Namespaces in XML". [1] [2]

Purpose

Since URI references can be long and may contain prohibited characters for element/attribute naming, QNames are used to create a mapping between the URI and a namespace prefix. The mapping enables the abbreviation of URIs, therefore it achieves a more convenient way to write XML documents (see example below).

Formal definition

QNames are formally defined by the W3C as: [3]

QName::=PrefixedName |UnprefixedNamePrefixedName::=Prefix ':'LocalPartUnprefixedName     ::=LocalPartPrefix::=NCNameLocalPart          ::=NCName

NCName is defined as follows:

NCName::=Name - (Char*':'Char*)(* An XML Name, minus the ":" *)Name::=NameStartChar (NameChar)*NameStartChar::=":"|[A-Z]|"_"|[a-z]|[#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]

Whereby the Prefix is used as placeholder for the namespace and the LocalPart as the local part of the qualified name. A local part can be an attribute name or an element name.

Example

<?xml version="1.0"?><docxmlns:x="https://example.com/ns/foo"><x:p/></doc>

In line two the prefix "x" is declared to be associated with the URI "http://example.com/ns/foo". This prefix can further on be used as abbreviation for this namespace. Subsequently, the tag "x:p" is a valid QName because it uses the "x" as namespace reference and "p" as local part. The tag "doc" is also a valid QName, but it consists only of a local part. [4]

See also

Related Research Articles

In computing, a namespace is a set of signs (names) that are used to identify and refer to objects of various kinds. A namespace ensures that all of a given set of objects have unique names so that they can be easily identified.

A Uniform Resource Identifier (URI) is a unique sequence of characters that identifies a logical or physical resource used by web technologies. URIs may be used to identify anything, including real-world objects, such as people and places, concepts, or information resources such as web pages and books. Some URIs provide a means of locating and retrieving information resources on a network ; these are Uniform Resource Locators (URLs). A URL provides the location of the resource. A URI identifies the resource by name at the specified location or URL. Other URIs provide only a unique name, without a means of locating or retrieving the resource or information about it, these are Uniform Resource Names (URNs). The web technologies that use URIs are not limited to web browsers. URIs are used to identify anything described using the Resource Description Framework (RDF), for example, concepts that are part of an ontology defined using the Web Ontology Language (OWL), and people who are described using the Friend of a Friend vocabulary would each have an individual URI.

<span class="mw-page-title-main">XML</span> Markup language by the W3C for encoding of data

Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. The World Wide Web Consortium's XML 1.0 Specification of 1998 and several other related specifications—all of them free open standards—define XML.

DocBook is a semantic markup language for technical documentation. It was originally intended for writing technical documents related to computer hardware and software, but it can be used for any other sort of documentation.

XPointer is a system for addressing components of XML-based Internet media. It is divided among four specifications: a "framework" that forms the basis for identifying XML fragments, a positional element addressing scheme, a scheme for namespaces, and a scheme for XPath-based addressing. XPointer Framework is a W3C recommendation since March 2003.

XSD, a recommendation of the World Wide Web Consortium (W3C), specifies how to formally describe the elements in an Extensible Markup Language (XML) document. It can be used by programmers to verify each piece of item content in a document, to assure it adheres to the description of the element it is placed in.

In computing, Resource Directory Description Language (RDDL) is an extension of XHTML Basic 1.0. An RDDL document, called a Resource Directory, provides a package of information about some target. The targets which RDDL was designed to describe are XML namespaces. The specification for RDDL has no official standing and has not been considered nor approved by any organization.

In compiler construction, name mangling is a technique used to solve various problems caused by the need to resolve unique names for programming entities in many modern programming languages.

In computer hypertext, a URI fragment is a string of characters that refers to a resource that is subordinate to another, primary resource. The primary resource is identified by a Uniform Resource Identifier (URI), and the fragment identifier points to the subordinate resource.

XML namespaces are used for providing uniquely named elements and attributes in an XML document. They are defined in a W3C recommendation. An XML instance may contain element or attribute names from more than one XML vocabulary. If each vocabulary is given a namespace, the ambiguity between identically named elements or attributes can be resolved.

RDFa or Resource Description Framework in Attributes is a W3C Recommendation that adds a set of attribute-level extensions to HTML, XHTML and various XML-based document types for embedding rich metadata within Web documents. The Resource Description Framework (RDF) data-model mapping enables its use for embedding RDF subject-predicate-object expressions within XHTML documents. It also enables the extraction of RDF model triples by compliant user agents.

XML documents have a hierarchical structure and can conceptually be interpreted as a tree structure, called an XML tree.

tempuri.org is the test default namespace URI used by Microsoft development products, like Visual Studio. It is available for XML Web services that are under development, but published XML Web services should use a more permanent namespace. The term is strictly a placeholder and all instances of it should be replaced with a more meaningful URI in production systems.

In computing, a CURIE defines a generic, abbreviated syntax for expressing Uniform Resource Identifiers (URIs). It is an abbreviated URI expressed in a compact syntax, and may be found in both XML and non-XML grammars. A CURIE may be considered a datatype.

Canonical XML is a normal form of XML, intended to allow relatively simple comparison of pairs of XML documents for equivalence; for this purpose, the Canonical XML transformation removes non-meaningful differences between the documents. Any XML document can be converted to Canonical XML.

A Formal Public Identifier (FPI) is a short piece of text with a particular structure that may be used to uniquely identify a product, specification or document. FPIs were introduced as part of Standard Generalized Markup Language (SGML), and serve particular purposes in formats historically derived from SGML. Some of their most common uses are as part of document type declarations (DOCTYPEs) and document type definitions (DTDs) in SGML, XML and historically HTML, but they are also used in the vCard and iCalendar file formats to identify the software product which generated the file.

XPath is an expression language designed to support the query or transformation of XML documents. It was defined by the World Wide Web Consortium (W3C) and can be used to compute values from the content of an XML document. Support for XPath exists in applications that support XML, such as web browsers, and many programming languages.

This article describes and classifies the Unicode characters that may validly appear in XML.

gSOAP is a C and C++ software development toolkit for SOAP/XML web services and generic XML data bindings. Given a set of C/C++ type declarations, the compiler-based gSOAP tools generate serialization routines in source code for efficient XML serialization of the specified C and C++ data structures. Serialization takes zero-copy overhead.

XPath 3 is the latest version of the XML Path Language, a query language for selecting nodes in XML documents. It supersedes XPath 1.0 and XPath 2.0.

References

  1. 1 2 Walsh, Norman, ed. (17 March 2004). "Using Qualified Names (QNames) as Identifiers in XML Content". W3.org. World Wide Web Consortium . Retrieved 2018-06-12.
  2. Bray, Tim; Hollander, Dave; Layman, Andrew, eds. (14 January 1999), "Namespaces in XML", W3.org, World Wide Web Consortium, retrieved 2018-06-12
  3. Namespaces in XML 1.0 (Second Edition)
  4. Namespaces in XML 1.0 (Second Edition)