Huge News!Announcing our $40M Series B led by Abstract Ventures.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.6 to 0.3.7

tests/attributes.js

3

CHANGELOG.md

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

## v0.3.7
* Fixes [#6](https://github.com/SaltwaterC/libxml-to-js/issues/6) simple test case losing attribute name. Thanks to [Richard Anaya](https://github.com/richardanaya) for the contribution.
## v0.3.6

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

2

lib/libxml-to-js.js

@@ -101,3 +101,3 @@ var libxmljs = require('libxmljs');

if (typeof jsobj[key] == 'undefined') {
if (children[i].childNodes().length == 1 && (children[i].childNodes()[0].type() == 'text' || children[i].childNodes()[0].type() == 'cdata')) {
if (children[i].childNodes().length == 1 && children[i].attrs().length == 0 && (children[i].childNodes()[0].type() == 'text' || children[i].childNodes()[0].type() == 'cdata')) {
var val = children[i].childNodes()[0].toString().trim();

@@ -104,0 +104,0 @@ if (children[i].childNodes()[0].type() == 'cdata') {

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

@@ -17,3 +17,4 @@ "description": "XML to JavaScript object parser based on libxmljs",

},
"contributors": [ {
"contributors": [
{
"name": "Brian White",

@@ -27,2 +28,6 @@ "url": "http://mscdex.net/"

"name": "VirgileD"
},
{
"name": "Richard Anaya",
"url": "http://www.richardanaya.com/"
}

@@ -29,0 +34,0 @@ ],

@@ -84,1 +84,2 @@ ## About

* @[VirgileD](https://github.com/VirgileD): improved text kludge and namespaces support
* @[Richard Anaya](https://github.com/richardanaya): fix for [#6](https://github.com/SaltwaterC/libxml-to-js/issues/6)

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

parser(fs.readFileSync('data/broken.xml').toString(), function (err, res) {
parser('This is a broken XML file.', function (err, res) {
callback = true;

@@ -11,0 +11,0 @@ assert.ok(err instanceof Error);

@@ -9,3 +9,5 @@ var parser = require('../');

parser(fs.readFileSync('data/ec2-describeimages.xml').toString(), function (err, res) {
var xml = fs.readFileSync('data/ec2-describeimages.xml').toString();
parser(xml, function (err, res) {
callback = true;

@@ -17,3 +19,3 @@ assert.ifError(err);

parser(fs.readFileSync('data/ec2-describeimages.xml').toString(), '//xmlns:blockDeviceMapping', function (err, res) {
parser(xml, '//xmlns:blockDeviceMapping', function (err, res) {
callbackXPath = true;

@@ -20,0 +22,0 @@ assert.ifError(err);

@@ -9,3 +9,5 @@ var parser = require('../');

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

@@ -43,3 +45,3 @@ assert.ifError(err);

parser(fs.readFileSync('data/text.xml').toString(), '//nouvelle/news', function (err, res) {
parser(xml, '//nouvelle/news', function (err, res) {
callbackXPath = true;

@@ -46,0 +48,0 @@ assert.ifError(err);

@@ -9,3 +9,5 @@ var parser = require('../');

parser(fs.readFileSync('data/wordpress-rss2.xml').toString(), function (err, res) {
var xml = fs.readFileSync('data/wordpress-rss2.xml').toString();
parser(xml, function (err, res) {
callback = true;

@@ -21,3 +23,3 @@ assert.ifError(err);

parser(fs.readFileSync('data/wordpress-rss2.xml').toString(), '//dc:creator', function (err, res) {
parser(xml, '//dc:creator', function (err, res) {
callbackXPath = true;

@@ -24,0 +26,0 @@ assert.ifError(err);

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