node package manager

dom2jsonml

Convert DOM to JSONML

dom2jsonml

Convert DOM to JSONML

var jsonMl = dom2jsonml( <Node> elem [, <func> filter( <array> jsonMl, <Node> elem)] [, <func> callback(err, <array> jsonMl)]);
var dom2jsonml = require('dom2jsonml');
dom2jsonml(window.document.body, function(err, jsonMl){
  if(err) throw err;
  else console.log(JSON.stringify(jsonMl));
});
var dom2jsonml = require('dom2jsonml');
var jsonMl = dom2jsonml(window.document.body);
if(null === jsonMl) throw new Error("Invalid DOM");
else console.log(JSON.stringify(jsonMl));

npm install dom2jsonml

  • Maqentaer