Posts

Showing posts from July, 2017

How to extract information from xml using node.js

There are plenty of methods available to extract information from an XML file and I have used the XPath select method to fetch the tag values. The following modules have to install using the NPM install Method. var fs = require ( 'fs' ), xml2js = require ( 'xml2js' ); const parser = new xml2js . Parser (); const xpath = require ( 'xpath' ), dom = require ( 'xmldom' ). DOMParser ; sample XML file name as test.xml. < groceryShop > < ownerName > xxxx </ ownerName > < name > DepartmentalStore </> < address > bangalore </ address > < pincode > 562320 </ pincode > </ groceryShop > The above modules will drive the process to fetch the information. //To read the file by using the readFile method which may be sync or async function fs . readFile ( 'test.xml' , function ( err , data ){ if ( err ){ //display error } else { // d

How to create dynamic Website

Image
            Creating a dynamic website is a challenging task for new developers who are learning technology. But here I will drive you to create a dynamic website with simple steps. Technology Details      keystone is the CMS framework and      Node.js is the server scripting language,      MongoDB is the database.      You have to configure node.js and MongoDB for local instances.  Configure Heroku for a free hosting service.Heroku provides up to 5 free hosting services for Node.js, Php, Java , Python technologies.  1.     Login to http://keystonejs.com/getting-started/ website and download and install node.js, MongoDB .        While installing node.js and MongoDB, copy the path and paste in environment variables (control panel à System à environment variables ) .             Configuration of mongo DB NOTE:  All installation steps that run in the Command Prompt (Admin) are done as an administrator. MongoDB Configuration for localhost  // Add MongoDB bin path to your system