PhoenixmlDb.Core

QName

Represents a qualified name (QName) consisting of a namespace, a local name, and an optional prefix — the XDM representation of element and attribute names.

#QName

Namespace: PhoenixmlDb.Core

Represents a qualified name (QName) consisting of a namespace, a local name, and an optional prefix — the XDM representation of element and attribute names.

In XML, a qualified name identifies an element or attribute within a namespace. For example, in <p:product xmlns:p="http://example.com/products">, the QName has namespace URI http://example.com/products, local name product, and prefix p.

Identity semantics: Two QNames are equal if and only if they share the same QName.Namespace and QName.LocalName. The QName.Prefix is not part of the identity — it exists purely for serialization and display purposes. This matches the XML Namespaces specification.

EQName syntax: The QName.ExpandedNamespace property supports the EQName notation Q{namespace-uri}local-name, which is the unambiguous form that does not rely on prefix bindings. When QName.ExpandedNamespace is set, QName.ToString produces the EQName form.

Common use cases: QNames appear when inspecting IXdmNode.NodeName, when setting XSLT initial template names or modes by qualified name, and when working with XPath/XQuery name tests programmatically.

#Example

Create and inspect a QName:

csharp
var name = new QName(NamespaceId.None, "product");
Console.WriteLine(name.LocalName);    // "product"
Console.WriteLine(name.PrefixedName); // "product"

var nsName = new QName(NamespaceId.Xsd, "string", "xs");
Console.WriteLine(nsName.PrefixedName); // "xs:string"
                                  

#Constructors

##ctor(PhoenixmlDb.Core.NamespaceId,String,String)

Creates a new QName with the specified namespace, local name, and optional prefix.

Parameters:

  • ns — The interned namespace identifier. Use NamespaceId.None for names with no namespace.

  • localName — The local (unqualified) part of the name. Must not be null.

  • prefix — Optional namespace prefix for display purposes. Does not affect identity.

Exceptions:

  • ArgumentNullExceptionlocalName is null.

#Properties

Name Description
ExpandedNamespace When non-null, holds the namespace URI from EQName syntax (Q{uri}local). Takes precedence over NamespaceId for namespace resolution. Affects ToString() output (uses Q{uri}local format when prefix is absent).
LocalName Gets the local (unqualified) part of the name.
Namespace Gets the interned namespace identifier for this QName.
Prefix Gets the optional namespace prefix, used for display only. Not part of QName identity.
PrefixedName Gets the display form of the name: prefix:localName if a prefix is present, or just localName otherwise.
ResolvedNamespace Gets the resolved namespace name, preferring ExpandedNamespace, then ResolvedNamespaceUri. Returns null if neither is available.
RuntimeNamespace When non-null, holds the resolved namespace for runtime-created QNames (e.g., from fn:QName() or xs:QName()). Does NOT affect ToString() output. Used by namespace-uri-from-QName() and QName eq comparison.

#See also