DMGambone / JXON-Parser

Converts an XML document into a JSON object
7 stars 3 forks source link

JXON - JavaScript XML Object Notation

This JXON library provides the core functionality to create JSON objects from XML, preserving as much of the original XML information as possible.

Why JXON?

Why even need a JSON from XML converter? While front-end development utilizes JavaScript and JSON for their language and data model, most of the web still uses XML as a means of communicating between systems. JXON helps bridge the gap between getting XML data and consuming it in JavaScript based systems.

Features

This current version of the JXON parser is very limited, only converting XML to JSON format. The JXON module contains 2 classes:

How to use

Using this JXON library is fairly straight forward.

You start by instantiating an instance of the JXON Parser. At that point, you have 3 parsing options:

Code Example

var parser = new JXON.Parser();
var jxon = null;

jxon = parser.parseXML(someXMLText);
// or
jxon = parser.parseNode(someXMLElement);
// or
jxon = parser.parseXMLFile("http://some.xml.file")
// or
parser.parseXMLFile("http://some.xml.file", function(jxon)
{
    //Do somthing
});

Dependencies

JXON currently has no external dependencies

Browser Support

JXON currently supports IE8+ as well as all modern browsers. Although it may also work in older versions of IE, it is not support and will never be supported.