Tell me more ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I created a small library to parse xml to javascript. Can anyone tell me if the design is correct for a library? or if there is a better technique. I wrote a small Usecase example here.
http://www.nyayapati.com/surya/2012/05/convert-xml-to-json-or-javascript-object/ You can find the code here https://bitbucket.org/surenrao/xml2json/src/57540122f71b/xml2json.js

Edit: Providing code sample

(function (window, undefined) {
    var X2J = {
        //public method
        parseXml: function (xmlDocument, xpathExpression) {
            //private method
            var isObjectEmpty = function (obj) {}; 
            var GetChildNode = function (domElement) {};
            //... 
        }, 
        //public method 
        getValue: function (jNode, name, index, default_value) {},
        //...
    };
    window.X2J = X2J;
} (window));

Usage:

var x2jObj = null;
$.get('shows.xml', function (xmlDocument) {
    x2jObj = X2J.parseXml(xmlDocument); //X2J.parseXml(xmlDocument, '/');         
    //x2jObj is called jNode   
    console.log('x2jObj populated', x2jObj);
    console.log('To get name "One Piece (US)"', X2J.getValue(x2jObj[0].Results[0].show[1], 'name'));
});

Thanks

share|improve this question
1  
This question is off-topic according to the FAQ - we can review a specific piece of code but not provide advice on "higher-level architecture and design of software systems" - codereview.stackexchange.com/faq – Laurent May 14 '12 at 13:22
Please include the code in the question. – palacsint May 14 '12 at 14:06

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.