xmlbuilder2
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -44,4 +44,4 @@ import { Node, Document } from "@oozcitak/dom/lib/dom/interfaces"; | ||
/** | ||
* Defines default namespaces to apply to all elements and attributes. | ||
*/ | ||
* Defines default namespaces to apply to all elements and attributes. | ||
*/ | ||
defaultNamespace?: { | ||
@@ -51,2 +51,8 @@ ele?: null | string; | ||
}; | ||
/** | ||
* Defines namespace aliases. | ||
*/ | ||
namespaceAlias?: { | ||
[key: string]: string | null; | ||
}; | ||
} | ||
@@ -93,2 +99,8 @@ /** | ||
}; | ||
/** | ||
* Defines namespace aliases. | ||
*/ | ||
namespaceAlias: { | ||
[key: string]: string | null; | ||
}; | ||
} | ||
@@ -95,0 +107,0 @@ /** |
@@ -8,3 +8,3 @@ "use strict"; | ||
"version", "encoding", "standalone", "keepNullNodes", "keepNullAttributes", | ||
"ignoreConverters", "convert", "defaultNamespace" | ||
"ignoreConverters", "convert", "defaultNamespace", "namespaceAlias" | ||
]); | ||
@@ -29,4 +29,12 @@ /** | ||
att: undefined | ||
}, | ||
namespaceAlias: { | ||
html: "http://www.w3.org/1999/xhtml", | ||
xml: "http://www.w3.org/XML/1998/namespace", | ||
xmlns: "http://www.w3.org/2000/xmlns/", | ||
mathml: "http://www.w3.org/1998/Math/MathML", | ||
svg: "http://www.w3.org/2000/svg", | ||
xlink: "http://www.w3.org/1999/xlink" | ||
} | ||
}; | ||
//# sourceMappingURL=interfaces.js.map |
@@ -638,6 +638,14 @@ "use strict"; | ||
} | ||
// look-up default namespace | ||
if (namespace === undefined) { | ||
// look-up default namespace | ||
namespace = (ele ? this._options.defaultNamespace.ele : this._options.defaultNamespace.att); | ||
} | ||
else if (namespace !== null && namespace[0] === "@") { | ||
// look-up namespace aliases | ||
const alias = namespace.slice(1); | ||
namespace = this._options.namespaceAlias[alias]; | ||
if (namespace === undefined) { | ||
throw new Error("Namespace alias `" + alias + "` is not defined. " + this._debugInfo()); | ||
} | ||
} | ||
return [namespace, name]; | ||
@@ -657,3 +665,3 @@ } | ||
if (!docNode) | ||
throw new Error("Owner document is null"); | ||
throw new Error("Owner document is null. " + this._debugInfo()); | ||
return docNode; | ||
@@ -660,0 +668,0 @@ } |
{ | ||
"name": "xmlbuilder2", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "xml", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
281167
43
5071