this is part of an npm (xml-js) to convert xml to json but it does not return any results, why?
import xmljs from 'xml-js';
var convert = xmljs
var xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
var result1 = convert.xml2json(xml, {compact: true, spaces: 4});
var result2 = convert.xml2json(xml, {compact: false, spaces: 4});
console.log(result1, '\n', result2);
@jessyerena
Are you sure that this is not just a quick example of how to set it up and you do not need to edit it to suit your own needs?
Finally, remember that to use it, you need to import it through the backend:
https://support.wix.com/en/article/corvid-managing-external-code-libraries-with-the-package-manager#using-an-installed-package241
Hope you can get it sorted out soon, or if it still doesn’t want to work, that somebody else can offer a better and correct fix to your issue.
Here’s an example that uses the xml-js NPM library available in the Wix Package Manager to modify an existing SVG image.
View the “Live” site in a browser page
Open the site template in the Wix Editor