Monday, January 23, 2012

NodeJs: Convert xml to JSON using Sax Module

Sax is power full module that helps you to parse xml data. And my problem in this module is, I need to reconstruct xml data and produce JSON string which is include element name, attributes and its content. Of course, Sax parses the xml as two major parts, namely node and text. 
Here I have to join the text with node and produce final result as JSON string.
To do this, Here I have done simple array operation (push and pop) in Sax’s provided function onopentag and ontext.


Note: Please leave your queries and suggestion as comment. 


  1. This is an awesome post. Really very informative and creative contents. This concept is a good way to enhance knowledge. I like it and help me to development very well. Thank you for this brief explanation and very nice information. Well, got good knowledge.
    WordPress development company in Chennai