ltxmlts
    Preparing search index...

    Class XName

    An immutable, interned representation of an XML qualified name.

    XName instances are cached: two instances for the same namespace and local name are the same object (identity equality). Supports Clark notation: {http://example.com/ns}localName.

    const n1 = XName.get('title');
    const n2 = XName.get('title');
    n1 === n2; // true -- same cached instance

    XName.get('{urn:example}item').localName; // 'item'
    XName.get('{urn:example}item').namespaceName; // 'urn:example'
    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    • Creates (or retrieves from cache) an XName.

      Parameters

      • namespace: XNamespace

        The namespace, or a Clark-notation string.

      • localName: string

        The local name (when providing an explicit namespace).

      Returns XName

      Because names are interned, calling new XName('foo') twice returns the same object.

    • Parameters

      • name: string

      Returns XName

    Properties

    localName: string

    The local (unqualified) part of this name.

    namespace: XNamespace

    The namespace of this name.

    Accessors

    • get namespaceName(): string

      Returns the namespace URI string of this name.

      Returns string

    Methods

    • Compares this name to another by identity (interned reference equality).

      Parameters

      • other: XName

        The name to compare against.

      Returns boolean

      true if both names are the same interned instance.

    • Returns the Clark-notation string for this name, or just the local name when the namespace is empty.

      Returns string

      The string representation, e.g. "{urn:example}item" or "item".

    • Returns a cached XName for the given namespace and local name, or parses a Clark-notation string.

      Parameters

      • namespace: XNamespace

        The namespace, or a string in Clark notation.

      • localName: string

        The local name (when providing an explicit namespace).

      Returns XName

      The cached XName instance.

    • Returns a cached XName for the given namespace and local name, or parses a Clark-notation string.

      Parameters

      • name: string

      Returns XName

      The cached XName instance.