Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @doodad-js/xml with all npm packages installed. Try it out:

require('@doodad-js/core').createRoot() .then(root => { return root.Doodad.Modules.load([ { module: '@doodad-js/xml' } ]); }) .then(root => { const xml = root.Doodad.Tools.Xml; // NOTE: Random songs return xml.parse("<songs><song><title>Another Me In Lack'ech</title><artist>Epica</artist></song><song><title>Silent Lucidity</title><artist>Queensryche</artist></song><song><title>One</title><artist>Metallica</artist></song></songs>"); }).then(doc => { const getItemValue = function(items, name) { return items.find(name)[0].getChildren().getAt(0).getValue(); }; for (let song of doc.getRoot().getChildren()) { const items = song.getChildren(); console.log(getItemValue(items, 'title') + " from " + getItemValue(items, 'artist')); }; }).catch(err => { console.error(err); });

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@doodad-js/xml v5.2.0-beta.0

XML Parser

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free