@federicocarboni/saxe
    Preparing search index...

    Interface NamespaceResolver

    Resolves namespace URIs and prefixes from the current element of an XML document.

    interface NamespaceResolver {
        lookupNamespace(prefix?: string): string | undefined;
        lookupPrefix(namespace: string): string | undefined;
    }
    Index

    Methods

    • Returns the namespace URI associated with the specified prefix.

      • If prefix is "xml" the return value is always the XML namespace.
      • If prefix is "xmlns" the return value is always the XMLNS namespace.
      • If prefix is undefined the return value is the default namespace URI.

      This function acts as if DOM Node lookupNamespaceURI were called on the current element being parsed, usually the element of the last call to SaxNamespaceHandler.startTag.

      Parameters

      • Optionalprefix: string

        Prefix to look for. Can be set to undefined to lookup the default namespace.

      Returns string | undefined

      • Returns the namespace URI associated with the specified prefix. Returns undefined if the prefix is not found.
    • Returns the prefix for the given namespace URI. When multiple prefixes are possible, this function searches the current element, then its attributes, and proceeds recursively on its ancestors; the first match is returned. If no match is found it returns undefined.

      Note that the return value is the most recent prefix bound to the specified namespace, but if the prefix is shadowed by a later declaration it may not be currently associated to the specified namespace.

      • If namespace is the XML namespace the return value is always "xml".
      • If namespace is the XMLNS namespace the return value is always "xmlns".
      • If namespace is empty the return value is always undefined.

      This function acts as if DOM Node lookupPrefix were called on the current element being parsed, usually the element of the last call to SaxNamespaceHandler.startTag.

      Parameters

      • namespace: string

        Namespace URI to look for.

      Returns string | undefined

      • Returns the prefix for the given namespace URI, if present, or returns undefined if it is not.