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

Method addNamespace

src/parser/ParserConfig.ts:157–178  ·  view source on GitHub ↗
(nsBase: Namespace)

Source from the content-addressed store, hash-verified

155 }
156
157 addNamespace(nsBase: Namespace) {
158 let uri = (this.nsMapper && this.nsMapper(nsBase.uri)) || nsBase.uri;
159 let nsParser = this.namespaceTbl[uri];
160
161 if(nsParser) return(nsParser.id);
162
163 this.unlink();
164
165 nsBase.uri = uri;
166 nsParser = new ParserNamespace(nsBase, this);
167 nsParser.id = this.native.addNamespace(nsParser.registerNative());
168
169 this.namespaceList[nsParser.id] = nsParser;
170 this.namespaceTbl[uri] = nsParser;
171
172 if(nsBase.id > this.maxNamespace) this.maxNamespace = nsBase.id;
173
174 if(nsBase.defaultPrefix) this.addPrefix(nsBase.defaultPrefix);
175 this.addUri(uri, nsParser);
176
177 return(nsParser.id);
178 }
179
180 bindNamespace(nsBase: Namespace, prefix?: string, parser?: Parser) {
181 this.addNamespace(nsBase);

Callers 4

bindNamespaceMethod · 0.95
getElementTokensMethod · 0.95
getAttributeTokensMethod · 0.95
constructorMethod · 0.45

Calls 4

unlinkMethod · 0.95
addPrefixMethod · 0.95
addUriMethod · 0.95
registerNativeMethod · 0.80

Tested by

no test coverage detected