Skip to content

dbankier/XMLTools-For-Appcelerator-Titanium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XMLTools Javascript Module for Titanium

Written in the style of http://www.thomasfrank.se/xml_to_json.html but for Titanium with extras. One new addition is the handling of nodes with both attributes and text content.

See the app.js file for a test case/example.

Quick Start

It is a commonJS module so:

var XMLTools = require("XMLTools");

Code snippets

Create and parse xml string:

  var xml = new XMLTools(your_xml_string);

If you already have Ti.XML.Document object, it can be passed to the constructor instead.

To get the xml documentElement:

  var documentElement = xml.getDocument();

To get the xml converted to an object:

  var my_object = xml.toObject();

To get the xml converted into JSON:

  var my_json = xml.toJSON();

If you just want to convert xml to json in one line:

  var my_json = new XMLTools(your_xml_string).toJSON()

Contributions

I'm happy for this module to grow/improve.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published