How to use libxmljs - 10 common examples

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 ey3ball / node-iptv-proxy / providers / _provider_vlc.js View on Github external
res.on('end', function () {
                        var xmlDoc = libxmljs.parseXmlString(xml);

                        /* eg: leaf[@name="FBX: France 2 HD (TNT)"]/@id' */
                        var res = xmlDoc.get("//leaf[@name=\"" + channel + "\"]");

                        if (!res) {
                                console.log("VLC_GET_CHANID: " + channel + " not found !");
                                cb("VLC Channel not found in playlist");
                        } else {
                                var id = res.attr("id").value();
                                console.log("VLC_GET_CHANID: " + id);
                                cb(null, { id: id });
                        }
                });
        });
github andrewbober / xsd2jsonschema / src / xmlschema / xsdFile.js View on Github external
constructor(uriParm) {
		this.baseFilename = path.basename(uriParm);
		this.xmlSchemaNamespace = 'http://www.w3.org/2001/XMLSchema';
		this.uri = uriParm;
		var data = fs.readFileSync(this.uri);
		this.xmlDoc = libxmljs.parseXml(data, { noblanks: true });
		this.schemaElement = this.xmlDoc.root();
		//this.includeUris = undefined;
		//this.namespace = undefined;
		//this.schemaNamespace = undefined;
		//this.namespaces = undefined;
		//this.targetNamespace = undefined;
		this.loadNamespaces();
		// this.dumpAttrs();
	}
	get baseFilename() {
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"

libxmljs

libxml bindings for v8 javascript engine

MIT
Latest version published 1 year ago

Package Health Score

36 / 100
Full package analysis

Similar packages