The steps for the recipe are as follows:
- Firstly, install a viable XML parsing library. Out of the box, Node.js ships with no XML parsing capability within its standard modules, so make use of the popular xml2js library, written by Marek Kubica, and install it using the npm package management tool:
unix$ npm install xml2js
- Import the required Node.js modules to operate. In this case, we make use of the child_process module in order to control a child process and the XML parsing module:
#!/usr/bin/env node const util = require("util"); const child_process = require('child_process'); const xml2js = require('xml2js');
- Define some program constants that we can refer to consistently later, including the XML phrase for the ...