buglabs / node-xml2json Goto Github PK
View Code? Open in Web Editor NEWConverts XML to JSON using node-expat
Converts XML to JSON using node-expat
Currently the dependencies show:
"dependencies": {
"node-expat": ">=1.4.1 <2.0.0"
}
for some reason node-expat 1.6.1 is failing during node-gyp build with Node js 0.8.11 and npm version 1.1.62
When you have a node with a string like this "00000" then you will get a 0 if coerce is true. Would be nice to add an option to look for strings with leading 0 and keep them as strings.
I see the code is developing but the latest stable release was tagged v0.3.2 a year ago?
What's the matter?
var obj = currentObject = {} is improper variable initialization, currentObject is being leaked to global scope and is being picked up in my application's test. It should be replaced with:
var obj = {}, var currentObject = {};
> [email protected] install /Users/thomas/Desktop/forerunner/node_modules/xml2json/node_modules/node-expat
> node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : ok /Users/thomas/.node_libraries
Checking for node prefix : ok /usr/local
Checking for header expat.h : not installed
/Users/thomas/Desktop/forerunner/node_modules/xml2json/node_modules/node-expat/wscript:13: error: the configuration failed (see '/Users/thomas/Desktop/forerunner/node_modules/xml2json/node_modules/node-expat/build/config.log')
npm info [email protected] Failed to exec install script
npm info /Users/thomas/Desktop/forerunner/node_modules/xml2json/node_modules/node-expat unbuild
npm info preuninstall [email protected]
npm info uninstall [email protected]
npm info postuninstall [email protected]
npm info /Users/thomas/Desktop/forerunner/node_modules/xml2json unbuild
npm info preuninstall [email protected]
npm info uninstall [email protected]
npm info postuninstall [email protected]
npm ERR! [email protected] install: `node-waf configure build`
npm ERR! `sh "-c" "node-waf configure build"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 11.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "xml2json"
npm ERR! cwd /Users/thomas/Desktop/forerunner
npm ERR! node -v v0.8.6
npm ERR! npm -v 1.1.48
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/thomas/Desktop/forerunner/npm-debug.log
npm ERR! not ok code 0
Now I needs xml result like:
<xml>
<parent>
<item>
<title>test_1</title>
</item>
<item>
<title>test_2</title>
</item>
</parent>
</xml>
I guessed that json should like:
{
xml:{
parent:[{item:{title:{$t:'test_1'}}},{item:{title:{$t:'test_2'}}}]
}
}
But, the result is:
`<xml>
<parent>
<item>
<title>test_1</title>
</item>
</parent>
<parent>
<item>
<title>test_2</title>
</item>
</parent>
</xml>
Is the json not is right? Has result which the method can implement me to want?
Word is that modules have to use node-gyp instead of node-waf to allow installation via npm if node-expat is involved.
The gist is, I have node v0.8.2 and this means all the time I spent writing code that uses node-xml2json for an earlier node (v0.6.x)) is wasted until the problem is fixed.
I don't know what's involved, but I'm hoping this issue can be prioritized because otherwise I have to find yet another xml-to-json module that will work. (Most seem to use node-expat).
thanks!
node
> var parser = require('xml2json');
undefined
> parser.toJson("<foo>bar</foo>");
'{"foo":"bar"}'
> parser.toXml('{"foo":"bar"}');
' foo="bar">'
> parser.toXml({"foo":"bar"});
' foo="bar">'
> :(
Hi,
I'm trying to parse a KML file, where the coordinates element has lat-lons separated by line breaks. When I parse it to JSON and back, it collapses all the whitespace. Is there a way to preserve it?
Thanks!
if 'coerce' is true and parameter of xml tag contains an empty string then in json field will be 0 (number) instead of empty string.
Isn't it better to return an empty string in this case?
if (value == '') {
return value;
}
[email protected] install /home/users/user/nodejs-push-notification-server/node_modules/xml2json/node_modules/node-expat
node-gyp rebuild
child_process: customFds option is deprecated, use stdio instead.
CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlparse.o
CC(target) Release/obj.target/expat/deps/libexpat/lib/xmltok.o
../deps/libexpat/lib/xmltok.c:471:1: warning: missing field 'isName2'
initializer [-Wmissing-field-initializers]
};
^
../deps/libexpat/lib/xmltok.c:484:1: warning: missing field 'isName2'
initializer [-Wmissing-field-initializers]
};
^
../deps/libexpat/lib/xmltok.c:504:1: warning: missing field 'isName2'
initializer [-Wmissing-field-initializers]
};
^
../deps/libexpat/lib/xmltok.c:517:1: warning: missing field 'isName2'
initializer [-Wmissing-field-initializers]
};
^
../deps/libexpat/lib/xmltok.c:730:1: warning: missing field 'isName2'
initializer [-Wmissing-field-initializers]
};
^
../deps/libexpat/lib/xmltok.c:749:1: warning: missing field 'isName2'
initializer [-Wmissing-field-initializers]
};
^
../deps/libexpat/lib/xmltok.c:762:1: warning: missing field 'isName2'
initializer [-Wmissing-field-initializers]
};
^
../deps/libexpat/lib/xmltok.c:775:1: warning: missing field 'isName2'
initializer [-Wmissing-field-initializers]
};
^
../deps/libexpat/lib/xmltok.c:871:1: warning: missing field 'isName2'
initializer [-Wmissing-field-initializers]
};
^
../deps/libexpat/lib/xmltok.c:890:1: warning: missing field 'isName2'
initializer [-Wmissing-field-initializers]
};
^
10 warnings generated.
CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlrole.o
LIBTOOL-STATIC Release/libexpat.a
CXX(target) Release/obj.target/node_expat/node-expat.o
../node-expat.cc:54:34: error: unknown type name 'Arguments'; did you mean
'v8::internal::Arguments'?
static Handle New(const Arguments& args)
^~~~~~~~~
v8::internal::Arguments
/home/ivyho/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note:
'v8::internal::Arguments' declared here
class Arguments;
^
../node-expat.cc:99:36: error: unknown type name 'Arguments'; did you mean
'v8::internal::Arguments'?
static Handle Parse(const Arguments& args)
^~~~~~~~~
v8::internal::Arguments
/home/user/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note:
'v8::internal::Arguments' declared here
class Arguments;
^
../node-expat.cc:171:42: error: unknown type name 'Arguments'; did you mean
'v8::internal::Arguments'?
static Handle SetEncoding(const Arguments& args)
^~~~~~~~~
v8::internal::Arguments
/home/ivyho/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note:
'v8::internal::Arguments' declared here
class Arguments;
^
../node-expat.cc:198:39: error: unknown type name 'Arguments'; did you mean
'v8::internal::Arguments'?
static Handle GetError(const Arguments& args)
^~~~~~~~~
v8::internal::Arguments
/home/user/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note:
'v8::internal::Arguments' declared here
class Arguments;
^
../node-expat.cc:212:35: error: unknown type name 'Arguments'; did you mean
'v8::internal::Arguments'?
static Handle Stop(const Arguments& args)
^~~~~~~~~
v8::internal::Arguments
/home/user/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note:
'v8::internal::Arguments' declared here
class Arguments;
^
../node-expat.cc:229:37: error: unknown type name 'Arguments'; did you mean
'v8::internal::Arguments'?
static Handle Resume(const Arguments& args)
^~~~~~~~~
v8::internal::Arguments
/home/user/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note:
'v8::internal::Arguments' declared here
class Arguments;
^
../node-expat.cc:244:36: error: unknown type name 'Arguments'; did you mean
'v8::internal::Arguments'?
static Handle Reset(const Arguments& args)
^~~~~~~~~
v8::internal::Arguments
/home/user/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note:
'v8::internal::Arguments' declared here
class Arguments;
^
../node-expat.cc:272:51: error: unknown type name 'Arguments'; did you mean
'v8::internal::Arguments'?
static Handle GetCurrentLineNumber(const Arguments& args)
^~~~~~~~~
v8::internal::Arguments
/home/user/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note:
'v8::internal::Arguments' declared here
class Arguments;
^
../node-expat.cc:285:53: error: unknown type name 'Arguments'; did you mean
'v8::internal::Arguments'?
static Handle GetCurrentColumnNumber(const Arguments& args)
^~~~~~~~~
v8::internal::Arguments
/home/user/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note:
'v8::internal::Arguments' declared here
class Arguments;
^
../node-expat.cc:298:50: error: unknown type name 'Arguments'; did you mean
'v8::internal::Arguments'?
static Handle GetCurrentByteIndex(const Arguments& args)
^~~~~~~~~
v8::internal::Arguments
/home/user/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note:
'v8::internal::Arguments' declared here
class Arguments;
^
../node-expat.cc:22:17: error: calling a protected constructor of class
'v8::HandleScope'
HandleScope scope;
^
/home/user/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: note: declared
protected here
V8_INLINE HandleScope() {}
^
../node-expat.cc:37:25: error: no member named 'NewSymbol' in 'v8::String';
did you mean 'IsSymbol'?
target->Set(String::NewSymbol("Parser"), t->GetFunction());
~~~~~~~~^~~~~~~~~
IsSymbol
/home/user/.node-gyp/0.12.0/deps/v8/include/v8.h:1379:8: note: 'IsSymbol'
declared here
bool IsSymbol() const;
^
../node-expat.cc:37:25: error: call to non-static member function without an
object argument
target->Set(String::NewSymbol("Parser"), t->GetFunction());
~~~~~~~~^~~~~~~~~
../node-expat.cc:39:24: error: use of undeclared identifier 'NODE_PSYMBOL'
sym_startElement = NODE_PSYMBOL("startElement");
^
../node-expat.cc:40:22: error: use of undeclared identifier 'NODE_PSYMBOL'
sym_endElement = NODE_PSYMBOL("endElement");
^
../node-expat.cc:41:22: error: use of undeclared identifier 'NODE_PSYMBOL'
sym_startCdata = NODE_PSYMBOL("startCdata");
^
../node-expat.cc:42:20: error: use of undeclared identifier 'NODE_PSYMBOL'
sym_endCdata = NODE_PSYMBOL("endCdata");
^
../node-expat.cc:43:16: error: use of undeclared identifier 'NODE_PSYMBOL'
sym_text = NODE_PSYMBOL("text");
^
../node-expat.cc:44:33: error: use of undeclared identifier 'NODE_PSYMBOL'
sym_processingInstruction = NODE_PSYMBOL("processingInstruction");
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/node_expat/node-expat.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/users/ivyho/IBMSVT32/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:268:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Darwin 12.5.0
gyp ERR! command "node" "/home/SVT32/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/users/nodejs-push-notification-server/node_modules/xml2json/node_modules/node-expat
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! Darwin 12.5.0
npm ERR! argv "/home/SVT32/bin/node" "/home/SVT32/bin/npm" "install" "xml2json"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/users/nodejs-push-notification-server/npm-debug.l
Hi
I'm having trouble with some systems out there when the json2xml produces xml with ' instead of "
so i changed line 41 in my local json2xml code to
xml += ' ' + key + '="' + obj[key] + '">';
to get it to work.
I'm not sure what the more accepted standard is, but it seems like some servers don't do it right, and the " seems to be more acceptable. Maybe you could have an option in the args
This module depends on a hard to build module node-expat
, which only builds on certain systems. It has been on version 2.0.0
for 9 months?
Cannot find module '../build/Release/node_expat.node'
While converting an XML-file with parser.toJson() I get the follwoing error
/node/node_modules/xml2json/lib/xml2json.js:182
throw new Error('There are errors in your xml file: ' + parser.getErro
^
Error: There are errors in your xml file: not well-formed (invalid token)
at Object.module.exports [as toJson] (/node/node_modules/xml2json/lib/xml2json.js:182:15)
But http://www.xmlvalidation.com/ sais, my XML-file is o.k. So how can I find out, what is the issue with that file? The file is to large to post it here (73 kB).
Is master stable enough to be published on npm ?
Reproduce:
xml_bug.xml:
<test>
<test>nested bug</test>
</test>
$ cat xml_bug.xml | xml2json
{"test":{"$t":"","test":"nested bug"}}
It probably has something to do with the deletion check.
https://github.com/buglabs/node-xml2json/blob/master/lib/xml2json.js#L68
Sorry not really an issue but more a question...
I want to convert a really big file (~2GB) and so I hit an error with fs.readFileSync. I've tried using fs.createReadStream but that throws an error "Parse buffer must be String or Buffer".
Can anyone help me out with how I might go about converting this file and also then writing the resultant json to disc (I'm a bit of a newb).
Thanks.
I'm trying to parse the following element:
<content type="html">@<a class=" " href="http://twitter.com/Skinz06">Skinz06</a> the fact its called a <em>cake</em> kinda gives it away.......also when fresh the softness makes it a <em>cake</em> for me! Love them</content>
and it becomes:
content:
{ type: 'html',
'$t': '@Skinz06the fact its called acakekinda gives it away.......also when fresh the softness makes it acakefor me! Love them' },
The problem is that the $t key is not valid when i try to insert it into mongodb:
"'key $t must not start with '$''"
Could it be that $t is not a valid key in json?
Can i configure the way node-xml2json contructs the key and supply something else for a key name, for example 'body'?
Thankful for any help
here iam using jquery graph, for that i need to convert xml to json. so for that iam using xml2json.js
success: function (msg) {
var json = $.xml2json(msg.d);
}
Here i am getting xml code as below. But it is not converting it. Can anyone help to solve it.
xs:complexType xs:complexType xs:simpleType /xs:restriction /xs:simpleType /xs:attribute /xs:complexType /xs:element /xs:choice /xs:complexType /xs:element /xs:schema�What license is this software released under? I do not see any license other than Copyright - am I missing something?
In line 53 and line 59:
xml = toXml(elem, xml);
When pass the xml
parameter to function toXml
, xml
will be copied, and the xml
is all strings above current processing cursor. This is a O(n^2) complexity to parse json to xml, where n is the length of xml content.
It's better to create a class, and all data are appended to a private member this.xml
. I will send a PR to this.
Hi,
The converter works very well in most circumstances, but on extracting XML text with parentheses it returns the HTML code e.g. (test) is returned as (test). Is there a solution for this problem?
Thanks
When I use this code in nodejs (full code on printscreen):
parser = require('xml2json');
var jsonData = JSON.parse(parser.toJson(']]>'))['value'];
console.log(jsonData)
I get in output this:
<TestReport id="TA" version="0" timestamp="748765765">
There is problem with parsing CDATA elemnt correct.
I think the best solution for this problem will change data in as another node in json or as simple string.
7F000200
Converts to
stuff = 7f+200
Is it trying to be intelligent?
Elements which contain ampersands aren't being consistently evaluated. The spacing before and/or after the ampersand is being removed.
Example data:
<element>foo & bar</element>
Results in:
"foo&bar"
without the spaces, instead of "foo & bar"
The link to Docs! don't work.
Javascript naming conventions capitalise acronyms such as JSON and XML...
toJson -> toJSON
toXml -> toXML
Please check below code snippet:
var xml2Json = require("xml2json")
var test = {text:["\"&aa","\"bb"]}
console.log(xml2Json.toXml(test))
it will print:
' text=""&aa" text=""bb">'
xml2json appears to be broken in node 0.8.8.
When I run the simple code below:
var xml2json = require('xml2json')
var obj = { foo: 'bar' }
var json = JSON.stringify(obj)
var xml = xml2json.toXml(json)
console.log('xml:', xml)
I get the following output to the console:
xml: foo="bar">
Given you have an XML like this:
<root>
<msg>
Test
This
Is
</msg>
</root>
and you parse it with:
var test = xml2json.toJson(xml, {object:true});
test contains:
{ root: { msg: 'TestThisIs' } }
<Column><Name>shit</Name><Value type="STRING"> asdf</Value></Column>
<Column PK="true"><Name>uid</Name><Value type="STRING">god</Value></Column>
there two spaces in ' asdf' ,but after parising:
{ Name: 'price', Value: { type: 'INTEGER', '$t': '23' } },
{ Name: 'shit', Value: { type: 'STRING', '$t': 'asdf' } },
the spaces are lost!!
Seams to not work at all.
there is no ../build/default
only ../build/Release
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '../build/default/node-expat'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (/FMS/node_modules/xml2json/node_modules/node-expat/lib/node-expat.js:3:13)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
It seems that '&' isn't being sanitized and replaced with the expected '&'. I've also tried passing explicitly turning on sanitization in the options parameter to no effect.
var xml = ' & ';
console.log(parser.toJson(xml));
Error: There are errors in your xml file: not well-formed (invalid token)
at Object.module.exports as toJson
the dependency on node-expat makes xml2json impossible to install on node.js setups that involve windows, requiring a full visual studio express 2010/2012 stack to be installed just to install this module. If this is unavoidable, would it be possible to ammend the README.md with information on resolving the cross-platform issue?
Code:
var parser = require('xml2json');
var options = {
object: false,
reversible: true,
coerce: true,
sanitize: true,
trim: true,
arrayNotation: true
};
Case 1:
var a = {"atv": {"body": {"test":"test"}}};
var xml_out = parser.toXml(a, options);
console.log(xml_out);
// output is
// [object Object]<atv><body test="test"></body></atv>
// note the extra [object Object]
Case 2:
var xml_out = parser.toXml(a);
console.log(xml_out);
// output is
// <atv><body test="test"></body></atv>
Is this intentional or a bug or a setting?
console.log(parser.toJson('<?xml version="1.0"?><root></root>'))
// { root: {} }
May be I'm doing something wrong
Pretty important difference for Windows users. Update your documenation to how it really is.
I was parsing some XML that had leading tabs inside an element. The tabs were stripped out, causing the data to be corrupted (the XML contained tab delimited data).
Currently node 0.8.x has abandoned node-waf and using the alternative node-gyp, which is a much more platform independent tool. node-expat, xml2json's dependency has already managed to adapt this change at v1.6.1. Would you bump node-expat's version so your module can be used for more audiences?
from
<root>
<foo name="foo1">
<bar name="bar1">
<foo name="foo2">
</root>
the following is generated:
{ root: { foo: [ { name: 'foo1' } , { name: 'foo2' } ],
bar: { name: 'bar1' } } }
thereby the order of the elements is gone.
I cannot do anything about the original structure.
Can I solve this problem with xml2json?
var x = '<node1><node2 a="1">v1</node2></node1>';
parser.toJson(x);
'{"node1":{"node2":{"a":1,"$t":"v1"}}}'
var j = '{"node1":{"node2":{"a":1,"$t":"v1"}}}';
parser.toXml(j);
'<node1><node2>v1</node2></node1>'
What happened to the attribute "a"?
node-expat uses Python and won't compile on Windows. So node-xml2json won't work on Windows. And all packages relying on node-xml2json won't work on Windows (like node wsdl2.js). So please (please) don't rely on node-expat
It seems like
myJsonThing == parser.toJson(parser.toXML(myJsonThing));
should be true, right?
The trouble is some inconsistency in the way XML element content is converted to JSON. In the case where an XML element has other attributes AND a value, the value becomes "$t": "elementValue". However when the XML element has no attributes, the JSON simply becomes "elementName": "elementValue".
For example:
{ myThing: { '$t': 'five' } }
> parser.toXml(myThing);
> '<myThing>five</myThing>'
> parser.toJson(parser.toXml(myThing));
> '{"myThing":"five"}'```
And in reverse:
```> xml = '<myThing>five</myThing>'
'<myThing>five</myThing>'
> parser.toJson(xml);
> '{"myThing":"five"}'
> parser.toXml(parser.toJson(xml));
> ' myThing=\'five\'>'```
in the sanitize function, it appears that
(1) there is re-substitution of '#'
(2) some missed substitution at end of string
test str = '&&<>()#&<>()#'
result = '&&<>()#&<>()#'
should have been = '&&<>()#&<>()#'
Hi,
I followed the instruction in the Readme, and here's what I get:
jan@jan:~/pro/test$ node -v
v0.5.6-pre
jan@jan:~/pro/test$ npm -v
1.0.27
jan@jan:~/pro/test$ npm install xml2json
> [email protected] install /home/jan/pro/test/node_modules/xml2json/node_modules/node-expat
> node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
Checking for header expat.h : yes
'configure' finished successfully (0.128s)
Waf: Entering directory `/home/jan/pro/test/node_modules/xml2json/node_modules/node-expat/build'
[1/2] cxx: node-expat.cc -> build/Release/node-expat_1.o
[2/2] cxx_link: build/Release/node-expat_1.o -> build/Release/node-expat.node
Waf: Leaving directory `/home/jan/pro/test/node_modules/xml2json/node_modules/node-expat/build'
'build' finished successfully (0.352s)
[email protected] ./node_modules/xml2json
└── [email protected]
jan@jan:~/pro/test$ node
> var parser = require('xml2json');
Error: Cannot find module '../build/default/node-expat'
at Function._resolveFilename (module.js:318:11)
at Function._load (module.js:263:25)
at Module.require (module.js:341:17)
at require (module.js:352:17)
at Object.<anonymous> (/home/jan/pro/test/node_modules/xml2json/node_modules/node-expat/lib/node-expat.js:3:13)
at Module._compile (module.js:416:26)
at Object..js (module.js:434:10)
at Module.load (module.js:335:31)
at Function._load (module.js:294:12)
at Module.require (module.js:341:17)
>
There seems to be a problem with the NODE_PATH, how do I solve this?
xml2json appears to be broken in node 0.8.8.
When I run the simple code below:
var xml2json = require('xml2json')
var obj = { foo: 'bar' }
var json = JSON.stringify(obj)
var xml = xml2json.toXml(json)
console.log('xml:', xml)
I get the following output to the console:
xml: foo="bar">
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.