UNPKG

typesxml

Version:

Open source XML library written in TypeScript

53 lines 1.63 kB
"use strict"; /******************************************************************************* * Copyright (c) 2023 - 2024 Maxprograms. * * This program and the accompanying materials * are made available under the terms of the Eclipse License 1.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/org/documents/epl-v10.html * * Contributors: * Maxprograms - initial API and implementation *******************************************************************************/ Object.defineProperty(exports, "__esModule", { value: true }); exports.XMLAttribute = void 0; const Constants_1 = require("./Constants"); const XMLUtils_1 = require("./XMLUtils"); class XMLAttribute { name; value; constructor(name, value) { this.name = name; this.value = value; } getName() { return this.name; } getValue() { return this.value; } setvalue(value) { this.value = value; } getNamespace() { if (this.name.indexOf(':') === -1) { return ''; } return this.name.substring(0, this.name.indexOf(':')); } getNodeType() { return Constants_1.Constants.ATTRIBUTE_NODE; } toString() { return this.name + '="' + XMLUtils_1.XMLUtils.unquote(XMLUtils_1.XMLUtils.cleanString(this.value)) + '"'; } equals(node) { if (node instanceof XMLAttribute) { return this.name === node.name && this.value === node.value; } return false; } } exports.XMLAttribute = XMLAttribute; //# sourceMappingURL=XMLAttribute.js.map