You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use your xmltojson converter and cannot seem to get it to work.
I am trying to use this npm module as part of a nativescript application that does not have a DOM. I have noticed that the stringToXML function only caters for DOM and Microsoft ActiveXObject and returns a null value.
I am testing this code directly in node.
var xmlc= require('xmltojson');
var testString = 'It Works!'; // get some xml (string or document/node)
var myOptions = {
mergeCDATA: false,
xmlns: false
};
var result = xmlc.parseString(testString,myOptions);
console.log('xmlToJSON=' + result);
/*
and get the following errors:
var result = xmlc.parseString(testString,myOptions);
^
TypeError: Object # has no method 'parseString'
at Object. (I:\Software\nodejs\test\test.js:21:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
any ideas?
many thanks
Peter
The text was updated successfully, but these errors were encountered:
xmlToJSON is meant to be used in a browser and relies on the availability of a compatible W3C DOM API. Unfortunately, nodejs does not provide such an implementation. Others have reported success using xmlDOM https://github.com/jindw/xmldom .
Hi,
I am trying to use your xmltojson converter and cannot seem to get it to work.
I am trying to use this npm module as part of a nativescript application that does not have a DOM. I have noticed that the stringToXML function only caters for DOM and Microsoft ActiveXObject and returns a null value.
I am testing this code directly in node.
var xmlc= require('xmltojson');
var testString = 'It Works!'; // get some xml (string or document/node)
var myOptions = {
mergeCDATA: false,
xmlns: false
};
var result = xmlc.parseString(testString,myOptions);
console.log('xmlToJSON=' + result);
/*
and get the following errors:
var result = xmlc.parseString(testString,myOptions);
^
TypeError: Object # has no method 'parseString'
at Object. (I:\Software\nodejs\test\test.js:21:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
any ideas?
many thanks
Peter
The text was updated successfully, but these errors were encountered: