"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fast_xml_parser_1 = require("fast-xml-parser");
const dot_object_1 = require("dot-object");
class XmlEditor {
    constructor(fileContent) {
        this.fileContent = fileContent;
        // X2jOptionsOptional
        this.parsingOptions = {
            attrNodeName: "#",
            ignoreAttributes: false,
            attributeNamePrefix: '',
            format: true
        };
        this.content = fast_xml_parser_1.parse(fileContent, this.parsingOptions);
    }
    get(xpath) {
        return dot_object_1.pick(xpath, this.content, false);
    }
    set(xpath, newValue) {
        console.info(`${xpath}=${newValue}`);
        dot_object_1.set(xpath, newValue, this.content);
    }
    toXml() {
        // console.info('toXml()', this.content);
        return new fast_xml_parser_1.j2xParser(this.parsingOptions).parse(this.content);
    }
}
exports.XmlEditor = XmlEditor;
//# sourceMappingURL=index.js.map