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.

Output:


Note: Please leave your queries and suggestion as comment. 

4 comments:

  1. Replies
    1. Great Article The IEEE Xplore digital library is your gateway to trusted research—journals, conferences, standards, ebooks, and educational courses—with more than 3 million articles to help you fuel imagination, build from previous research, and inspire new ideas. Node Js Projects for Final Year IEEE will pave a new way in knowledge-sharing and spreading ideas across the globe. Project Centers in Chennai for CSE Node.js Corporate Training JavaScript Training in Chennai

      Delete
  2. 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

    ReplyDelete
  3. Enjoyed reading the article above, really explains everything in detail, the article is very interesting and effective. Thank you and good luck for the upcoming articles Nodejs training

    ReplyDelete