New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

libxml-to-js

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libxml-to-js - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

3

CHANGELOG.md

@@ -0,1 +1,4 @@

## v0.3.6
* Fixes [#5](https://github.com/SaltwaterC/libxml-to-js/pull/5) which was introduced in v0.3.5.
## v0.3.5

@@ -2,0 +5,0 @@ * Improved the text kludge and namespaces support. Thanks to @[VirgileD](https://github.com/VirgileD) for the contribution.

7

lib/libxml-to-js.js

@@ -151,8 +151,11 @@ var libxmljs = require('libxmljs');

}
var xmlDocument, jsDocument, selected = [];
var xmlDocument, jsDocument, selected = [], xmlns = null;
try {
xmlDocument = libxmljs.parseXmlString(xml);
jsDocument = libxml2js(xmlDocument);
if( jsDocument['@'] && jsDocument['@'].xmlns) {
xmlns = jsDocument['@'].xmlns;
}
if( !! xpath) {
xmlDocument.find(xpath, jsDocument['@'].xmlns).forEach(function(item) {
xmlDocument.find(xpath, xmlns).forEach(function(item) {
selected.push(libxml2js(item, true).jsobj);

@@ -159,0 +162,0 @@ });

{
"name": "libxml-to-js",
"version": "0.3.5",
"version": "0.3.6",
"main": "./lib/libxml-to-js.js",

@@ -5,0 +5,0 @@ "description": "XML to JavaScript object parser based on libxmljs",

@@ -6,3 +6,7 @@ var parser = require('../');

var callback = false;
var callbackXPath = false;
parser(fs.readFileSync('data/text.xml').toString(), function (err, res) {
callback = true;
assert.ifError(err);

@@ -38,1 +42,17 @@ assert.deepEqual({

});
parser(fs.readFileSync('data/text.xml').toString(), '//nouvelle/news', function (err, res) {
callbackXPath = true;
assert.ifError(err);
assert.deepEqual({
"auteur": "Bizzard5",
"date": "17 Août 2008",
"text": {}
},
res[0]);
});
process.on('exit', function () {
assert.ok(callback);
assert.ok(callbackXPath);
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc