Oracle Magazine Special offer for AjaxImpact.com Visitors!! Subscribe to Oracle Magazine for Free!
AJAX IMPACT


ARTICLES
BadgerFish : Tool to translate XML to JSON
04/17/2006, By Brian McCallister



Brian McCallister has developed excellent tool to translate the XML to JSON, he named this tool as BadgerFish.

What is BadgerFish?

BadgerFish is a convention for translating an XML document into a JSON object. Once you've got your XML document represented as a JSON object, it's easy to manipulate from within Javascript. If you're familiar with PHP's SimpleXML extension, think of BadgerFish as aiming for a similar goal: making it simpler to do common manipulations of XML documents with a predictable structure.

How does it work?

1. Element names become object properties.

2. Text content of elements goes in the $ property of an object.

3. Nested elements become nested properties

4. Multiple elements at the same level become array elements.

5. Attributes go in properties whose names begin with @.

6. Active namespaces for an element go in the element's @xmlns property.

7.The default namespace URI goes in @xmlns.$.

8. Other namespaces go in other properties of @xmlns.

9. Elements with namespace prefixes become object properties, too.

You can download BadgerFish from here.

   Explore BadgerFish now...

 Rate this Ajax Articles
Error connecting to mysql