Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
xmlobject
Advanced tools
Readme
Convert javascript object from and to xml string.
$ npm install --save xmlobject
var XML = require('xmlobject');
// Deserialize from xml
var ns = "http://www.example.com/xml/test"
var defaultns = "http://www.example.com/xml/default"
var s = '<a xmlns="'+defaultns+'" xmlns:test="'+ns+'" b="c" d="e"><test:f test:i="j">g<h /></test:f></a>';
XML.deserialize(s, function(err,r) {
console.log(r.asJSON())
var f1 = r.firstChild(ns,"f");
console.log("i: " + f1.getAttribute(ns, "i"));
console.log("f: " + f1.getText());
/* ->
{"name":"a","attributes":{"xmlns:":"http://www.example.com/xml/default","xmlns":"http://www.example.com/xml/default","xmlns:test":"http://www.example.com/xml/test","b":"c","d":"e"},"namespaces":[{"prefix":"","value":"http://www.example.com/xml/default"},{"prefix":"test","value":"http://www.example.com/xml/test"}],"children":[{"name":"test:f","attributes":{"test:i":"j"},"namespaces":[],"children":["g",{"name":"h","attributes":{},"namespaces":[],"children":[]}]}]}
*/
});
// Serialize to xml
var a = new XML("a");
a.setAttribute("b","c");
a.setAttribute("d","e");
a.setNamespace(defaultns);
a.addNamespace("test", ns);
var f = a.createChild(ns,"f");
f.setAttribute(ns,"i","j");
f.addChild("g");
f.createChild("h");
a.serialize(function(err, r) {
console.log(r);
/* ->
<a b="c" d="e" xmlns="http://www.example.com/xml/default" xmlns:test="http://www.example.com/xml/test"><test:f test:i="j">g<h /></test:f></a>
*/
});
xmlobject is a perfect fit for small parsing scenario where all data could remain in memory but would not be perfectly optimized for parsing mega-octets of xml content where a stream/sax based approach would be better.
MIT © Aloïs Deniel
FAQs
Convert javascript objects to and from xml strings.
The npm package xmlobject receives a total of 389 weekly downloads. As such, xmlobject popularity was classified as not popular.
We found that xmlobject demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.