MCPcopy Create free account
hub / github.com/charto/cxml / constructor

Method constructor

src/parser/ParserNamespace.ts:11–35  ·  view source on GitHub ↗

@param base Parser-independent namespace definition.

(public parent: Namespace | ParserNamespace, config: ParserConfig)

Source from the content-addressed store, hash-verified

9
10 /** @param base Parser-independent namespace definition. */
11 constructor(public parent: Namespace | ParserNamespace, config: ParserConfig) {
12 if(parent instanceof ParserNamespace) {
13 this.base = parent.base;
14 this.native = parent.native.clone();
15
16 this.elementSet = new TokenSet(config.elementSpace, parent.elementSet);
17 this.attributeSet = new TokenSet(config.attributeSpace, parent.attributeSet);
18 } else {
19 this.base = parent;
20 this.native = new NativeNamespace(parent.uri);
21
22 this.elementSet = new TokenSet(config.elementSpace);
23 this.attributeSet = new TokenSet(config.attributeSpace);
24
25 this.attributeSet.addToken(config.xmlnsToken);
26
27 for(let name of parent.elementNameList) {
28 this.addElement(name);
29 }
30
31 for(let name of parent.attributeNameList) {
32 this.addAttribute(name);
33 }
34 }
35 }
36
37 registerNative(): NativeNamespace {
38 if(this.elementSet.dirty) {

Callers

nothing calls this directly

Calls 4

addElementMethod · 0.95
addAttributeMethod · 0.95
addTokenMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected