Php's Simplexmlelement Analog For Node.js
The best XML reading and writing API I've ever used is PHP's SimpleXMLElement. For example, to create a DOM of the following XML text:
Solution 1:
Yep, it has jsdom.
jsdom allows you to use the DOM as if you were on the client.
You can even use jQuery with it if bare DOM scares you.
Example from doc:
// Run some jQuery on a html fragmentvar jsdom = require('jsdom');
jsdom.env('<p><a class="the-link" href="https://github.com/tmpvar/jsdom">jsdom\'s Homepage</a></p>', [
'http://code.jquery.com/jquery-1.5.min.js'
],
function(errors, window) {
console.log("contents of a.the-link:", window.$("a.the-link").text());
});
Post a Comment for "Php's Simplexmlelement Analog For Node.js"