How to use the libxmljs.Document function in libxmljs

To help you get started, we’ve selected a few libxmljs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudera / hue / tools / sql-docs / Topic.js View on Github external
constructor(docRootPath, ref) {
    this.docRootPath = docRootPath;
    this.ref = ref;
    this.children = [];

    // These are set during parsing
    this.fragment = undefined;
    this.domXml = new libxml.Document().node('div');
  }
github amida-tech / blue-button / lib / generator / ccda / templates / results.js View on Github external
module.exports = function (data, codeSystems, isCCD, CCDxml) {
    var doc = new libxmljs.Document();
    var xmlDoc = libCCDAGen.header_v2(!isCCD ? doc : CCDxml, "2.16.840.1.113883.10.20.22.2.3",
        "2.16.840.1.113883.10.20.22.2.3.1", sec_entries_codes["ResultsSection"], "RESULTS", isCCD);

    // entries loop
    var n = data.length;
    for (var i = 0; i < n; ++i) {
        updateEntry(xmlDoc, data[i]);
    }

    xmlDoc = xmlDoc.parent(); // end clinicalDocument
    return isCCD ? xmlDoc : doc;
};
github amida-tech / blue-button / lib / generator / ccda / templates / allergies.js View on Github external
module.exports = function (data, codeSystems, isCCD, CCDxml) {
    // create a new xml document and generate the header
    var doc = new libxmljs.Document();
    var xmlDoc = libCCDAgen.header(!isCCD ? doc : CCDxml, "2.16.840.1.113883.10.20.22.2.6", "2.16.840.1.113883.10.20.22.2.6.1",
        "48765-2", "2.16.840.1.113883.6.1", undefined, undefined, "ALLERGIES, ADVERSE REACTIONS, ALERTS", isCCD);

    // Now loop over each entry in the data set
    for (var i = 0; i < data.length; i++) {
        updateEntry(xmlDoc, data[i], i);
    }
    xmlDoc = xmlDoc.parent() // end section
    .parent(); // end clinicalDocument (or component)
    return isCCD ? xmlDoc : doc;
};
github amida-tech / blue-button / lib / generator / ccda / templates / social_history.js View on Github external
module.exports = function (data, codeSystems, isCCD, CCDxml) {
    var doc = new libxmljs.Document();
    var xmlDoc = libCCDAGen.header_v2(!isCCD ? doc : CCDxml, "2.16.840.1.113883.10.20.22.2.17", 
        undefined, sec_entries_codes["SocialHistorySection"], "SOCIAL HISTORY", isCCD);

    // entries loop
    for (var i = 0; i < data.length; i++) {
        var smoking = data[i]["value"] ? data[i]["value"].indexOf("smoke") > -1 : undefined;

        var e = xmlDoc.node('entry').attr({typeCode: "DRIV"});
        var ob = e.node('observation').attr({classCode: "OBS", moodCode: "EVN"});
        var tId = smoking ? "2.16.840.1.113883.10.20.22.4.78" : "2.16.840.1.113883.10.20.22.4.38";
        ob.node('templateId').attr({root: tId}); 
        libCCDAGen.id(ob, data[i].identifiers);
        if (smoking) {
            libCCDAGen.code(ob, undefined, sec_entries_codes["SmokingStatusObservation"]);
        } else {
            var c = libCCDAGen.code(ob, data[i].code);
github amida-tech / blue-button / lib / generator / ccda / templates / problems.js View on Github external
module.exports = function (data, codeSystems, isCCD, CCDxml) {
    var doc = new libxmljs.Document();
    var xmlDoc = libCCDAGen.header(!isCCD ? doc : CCDxml, "2.16.840.1.113883.10.20.22.2.5", "2.16.840.1.113883.10.20.22.2.5.1", "11450-4",
        "2.16.840.1.113883.6.1", "LOINC", "PROBLEM LIST", "PROBLEMS", isCCD);

    // entries loop
    for (var i = 0; i < data.length; i++) {
        var e = xmlDoc.node('entry').attr({typeCode: "DRIV"});
        var act = e.node('act').attr({classCode: "ACT", moodCode: "EVN"}); // problem concern act
        act.node('templateId').attr({root: "2.16.840.1.113883.10.20.22.4.3"});
        libCCDAGen.id(act, data[i].source_list_identifiers);
        libCCDAGen.code(act, undefined, sec_entries_codes["ProblemConcernAct"]);
        act.node('statusCode').attr({code: 'completed'});
        libCCDAGen.effectiveTime(act, libCCDAGen.getTimes(data[i].date_time));
        var er = act.node('entryRelationship').attr({typeCode: "SUBJ"});
        var obsAttrs = {classCode: "OBS", moodCode: "EVN"};
        if (data[i].hasOwnProperty('negation_indicator')) {
            obsAttrs.negationInd = data[i].negation_indicator.toString();
github amida-tech / blue-button / lib / generator / ccda / templates / encounters.js View on Github external
module.exports = function (data, codeSystems, isCCD, CCDxml) {
    var doc = new libxmljs.Document();
    var xmlDoc = libCCDAGen.header(!isCCD ? doc : CCDxml, "2.16.840.1.113883.10.20.22.2.22", "2.16.840.1.113883.10.20.22.2.22.1",
        "46240-8", "2.16.840.1.113883.6.1", "LOINC", "History of encounters", "ENCOUNTERS", isCCD);

    // entries loop
    for (var i = 0; i < data.length; i++) {
        // start the templating
        var e = xmlDoc.node('entry').attr({
            typeCode: "DRIV"
        });
        var enc = e.node('encounter').attr({
            classCode: "ENC",
            moodCode: "EVN"
        }); // encounter activities

        enc.node('templateId').attr({
            root: "2.16.840.1.113883.10.20.22.4.49"
github devongovett / reader / src / utils.js View on Github external
exports.respond = function(res, response, defaultFormat) {
    var format = res.req.query.output || defaultFormat || 'json';
    
    switch (format) {
        case 'json':
            return res.json(response);
            
        case 'xml':
            var doc = new xml.Document();
            generateXML(doc, response);
            return res.type('xml').send(doc.toString());
            
        default: 
            res.send(400, 'Invalid output format');
    }
};
github developmentseed / macrocosm / services / xml.js View on Github external
writeDoc: function() {
    var doc = new libxml.Document();
    doc.node('osm').attr({ version: 0.6, generator: GENERATOR });
    return doc;
  },
github exfm / node-aws / lib / aws.js View on Github external
self.xml = function(rootElement, namespace) {
    if (null == xml) {
      if ('undefined' !== typeof rootElement) {
        xml = new libxmljs.Document();

        var rootNode = xml.node(rootElement);

        if ('undefined' !== typeof namespace) {
          rootNode.namespace(namespace);
        }
      }
    }

    return xml;
  };
}
github aws / aws-sdk-js / lib / xml / builder_libxmljs.js View on Github external
toXML: function buildXML(params) {
    var xml = new libxml.Document();
    this.serializeStructure(this.root, this.rules, params, xml, this.xmlns);
    return xml.root().toString();
  },

libxmljs

libxml bindings for v8 javascript engine

MIT
Latest version published 7 months ago

Package Health Score

46 / 100
Full package analysis

Similar packages