How to use the libxmljs.parseXmlString 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 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 CartoDB / grainstore / test / mml_builder.js View on Github external
}).toXML(function(err, data){
          if ( err ) { return done(err); }
          var xmlDoc = libxmljs.parseXmlString(data);
          var xpath = "//MaxScaleDenominator";
          var x = xmlDoc.get(xpath);
          assert.ok(x, "Xpath '" + xpath + "' does not match " + xmlDoc);
          assert.equal(x.text(), "50000000");
          done();
      });
  });
github CartoDB / grainstore / test / mml_builder.js View on Github external
.toXML(function(err, data){
                if ( err ) { return done(err); }
                var xmlDoc = libxmljs.parseXmlString(data);
                var color = xmlDoc.get("//@fill");
                assert.equal(color.value(), "#000000");
                done();
            });
    });
github Nexus-Mods / vortex-games / game-darkestdungeon / index.js View on Github external
.then(xmlData => {
      try {
        projectData = parseXmlString(xmlData);
      } catch (err) {
        return Promise.reject(new util.DataInvalid('Failed to parse project file.'))
      }

      const modDataPath = projectData.get('//ModDataPath');
      modDataPath.text(modPath);
      return fs.writeFileAsync(projectFilePath, projectData.toString(), { encoding: 'utf-8' });
    })
}
github Nexus-Mods / vortex-games / game-7daystodie / index.js View on Github external
.then(xmlData => {
      try {
        modInfo = parseXmlString(xmlData);
        const modName = modInfo.get('//Name');
        return ((modName !== undefined) && (modName.attr('value').value() !== undefined))
          ? Promise.resolve(modName.attr('value').value())
          : Promise.reject(new util.DataInvalid('Unexpected modinfo.xml format'));
      } catch (err) {
        return Promise.reject(new util.DataInvalid('Failed to parse ModInfo.xml file'))
      }
    })
}

libxmljs

libxml bindings for v8 javascript engine

MIT
Latest version published 1 year ago

Package Health Score

36 / 100
Full package analysis

Similar packages