xmlObjectifier a simple way to convert XML to a JSON object.
In just one method call your XML document is converted into a JavaScript Object and is ready for simple data browsing using a familiar dot notation. xmlObjectifier is written in client-side JavaScript in an object oriented manner to reduce processing overhead and to provide optimal compatibility across various browsers.
xmlObjectifier was written to simplify a task of working with XML data provided by web services or just static XML files. Complexity of working with DOM tree impacts code flexibility and increases the size of your script.
It works by taking a DOM Document object as an input parameter, scans through it reading all nodes, values and attributes and dynamically assembles a JSON object. The way JSON object is constructed is that all XML nodes are automatically converted to Arrays baring the name of the XML node they represent, and XML attributes are converted to fields of each array element they belong to.
The only possible exception to the name being exactly replicated is when node/attribute names contain dash ("-") in it's name, in that case all dashes are converted to underscores ("_") due to JavaScript compatibility issues (objects can not contain dashes in their names).