222
schangxiang@126.com
2025-06-13 6a8393408d8cefcea02b7a598967de8dc1e565c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
interface INamespace {
    declared: boolean;
    prefix: string;
    uri: string;
}
/**
 * Scope for XML namespaces
 * @param {NamespaceScope} [parent] Parent scope
 * @returns {NamespaceScope}
 * @constructor
 */
declare class NamespaceScope {
    parent: NamespaceScope;
    namespaces: {
        [key: string]: INamespace;
    };
    constructor(parent: NamespaceScope);
    /**
     * Look up the namespace URI by prefix
     * @param {String} prefix Namespace prefix
     * @param {Boolean} [localOnly] Search current scope only
     * @returns {String} Namespace URI
     */
    getNamespaceURI(prefix: string, localOnly?: boolean): string;
    getNamespaceMapping(prefix: string): INamespace;
    /**
     * Look up the namespace prefix by URI
     * @param {String} nsUri Namespace URI
     * @param {Boolean} [localOnly] Search current scope only
     * @returns {String} Namespace prefix
     */
    getPrefix(nsUri: string, localOnly?: boolean): string;
}
/**
 * Namespace context that manages hierarchical scopes
 * @returns {NamespaceContext}
 * @constructor
 */
export declare class NamespaceContext {
    scopes: NamespaceScope[];
    prefixCount: number;
    currentScope?: NamespaceScope;
    constructor();
    /**
     * Add a prefix/URI namespace mapping
     * @param {String} prefix Namespace prefix
     * @param {String} nsUri Namespace URI
     * @param {Boolean} [localOnly] Search current scope only
     * @returns {boolean} true if the mapping is added or false if the mapping
     * already exists
     */
    addNamespace(prefix: string, nsUri: string, localOnly?: boolean): boolean;
    /**
     * Push a scope into the context
     * @returns {NamespaceScope} The current scope
     */
    pushContext(): NamespaceScope;
    /**
     * Pop a scope out of the context
     * @returns {NamespaceScope} The removed scope
     */
    popContext(): NamespaceScope;
    /**
     * Look up the namespace URI by prefix
     * @param {String} prefix Namespace prefix
     * @param {Boolean} [localOnly] Search current scope only
     * @returns {String} Namespace URI
     */
    getNamespaceURI(prefix: string, localOnly?: boolean): string;
    /**
     * Look up the namespace prefix by URI
     * @param {String} nsURI Namespace URI
     * @param {Boolean} [localOnly] Search current scope only
     * @returns {String} Namespace prefix
     */
    getPrefix(nsUri: string, localOnly?: boolean): string;
    /**
     * Register a namespace
     * @param {String} nsUri Namespace URI
     * @returns {String} The matching or generated namespace prefix
     */
    registerNamespace(nsUri: string): string;
    /**
     * Declare a namespace prefix/uri mapping
     * @param {String} prefix Namespace prefix
     * @param {String} nsUri Namespace URI
     * @returns {Boolean} true if the declaration is created
     */
    declareNamespace(prefix: string, nsUri: string): boolean;
}
export {};