@aws-sdk/xml-builder
Advanced tools
Comparing version 3.183.0 to 3.186.0
@@ -6,2 +6,10 @@ # Change Log | ||
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06) | ||
**Note:** Version bump only for package @aws-sdk/xml-builder | ||
# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03) | ||
@@ -8,0 +16,0 @@ |
@@ -0,5 +1,7 @@ | ||
import { __values } from "tslib"; | ||
import { escapeAttribute } from "./escape-attribute"; | ||
import { XmlText } from "./XmlText"; | ||
export class XmlNode { | ||
constructor(name, children = []) { | ||
var XmlNode = (function () { | ||
function XmlNode(name, children) { | ||
if (children === void 0) { children = []; } | ||
this.name = name; | ||
@@ -9,4 +11,4 @@ this.children = children; | ||
} | ||
static of(name, childText, withName) { | ||
const node = new XmlNode(name); | ||
XmlNode.of = function (name, childText, withName) { | ||
var node = new XmlNode(name); | ||
if (childText !== undefined) { | ||
@@ -19,31 +21,44 @@ node.addChildNode(new XmlText(childText)); | ||
return node; | ||
} | ||
withName(name) { | ||
}; | ||
XmlNode.prototype.withName = function (name) { | ||
this.name = name; | ||
return this; | ||
} | ||
addAttribute(name, value) { | ||
}; | ||
XmlNode.prototype.addAttribute = function (name, value) { | ||
this.attributes[name] = value; | ||
return this; | ||
} | ||
addChildNode(child) { | ||
}; | ||
XmlNode.prototype.addChildNode = function (child) { | ||
this.children.push(child); | ||
return this; | ||
} | ||
removeAttribute(name) { | ||
}; | ||
XmlNode.prototype.removeAttribute = function (name) { | ||
delete this.attributes[name]; | ||
return this; | ||
} | ||
toString() { | ||
const hasChildren = Boolean(this.children.length); | ||
let xmlText = `<${this.name}`; | ||
const attributes = this.attributes; | ||
for (const attributeName of Object.keys(attributes)) { | ||
const attribute = attributes[attributeName]; | ||
if (typeof attribute !== "undefined" && attribute !== null) { | ||
xmlText += ` ${attributeName}="${escapeAttribute("" + attribute)}"`; | ||
}; | ||
XmlNode.prototype.toString = function () { | ||
var e_1, _a; | ||
var hasChildren = Boolean(this.children.length); | ||
var xmlText = "<".concat(this.name); | ||
var attributes = this.attributes; | ||
try { | ||
for (var _b = __values(Object.keys(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var attributeName = _c.value; | ||
var attribute = attributes[attributeName]; | ||
if (typeof attribute !== "undefined" && attribute !== null) { | ||
xmlText += " ".concat(attributeName, "=\"").concat(escapeAttribute("" + attribute), "\""); | ||
} | ||
} | ||
} | ||
return (xmlText += !hasChildren ? "/>" : `>${this.children.map((c) => c.toString()).join("")}</${this.name}>`); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
return (xmlText += !hasChildren ? "/>" : ">".concat(this.children.map(function (c) { return c.toString(); }).join(""), "</").concat(this.name, ">")); | ||
}; | ||
return XmlNode; | ||
}()); | ||
export { XmlNode }; |
import { escapeElement } from "./escape-element"; | ||
export class XmlText { | ||
constructor(value) { | ||
var XmlText = (function () { | ||
function XmlText(value) { | ||
this.value = value; | ||
} | ||
toString() { | ||
XmlText.prototype.toString = function () { | ||
return escapeElement("" + this.value); | ||
} | ||
} | ||
}; | ||
return XmlText; | ||
}()); | ||
export { XmlText }; |
{ | ||
"name": "@aws-sdk/xml-builder", | ||
"version": "3.183.0", | ||
"version": "3.186.0", | ||
"description": "XML builder for the AWS SDK", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
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
41114
249