rss-api
A series of useful APIs for xml(specially for RSS) and json.
Version : 1.0.2
Author : Shaffer John
Installation
$ npm install rss-api
Usage
var rss = ;
Example
var rss = ; var xml = '<?xml version="1.0" encoding="UTF-8" ?>'+'<a test="123">'+ '<b>456</b>'+ '<c>789</c>'+'</a>';
xml2json
**Prototype : **
xml2json = function(xml
,callback
)
callback
is NOT necessary
var json = rss;//output/*{ "a": { "-test": "123", //"-" is a sign of attribution "b": "456", "c": "789" }}*/ //You can also use callback, for example:rss;
json2xml
**Prototype : **
json2xml = function(json
,isRSS
,callback
)
isRSS
andcallback
is NOT necessary- Default for
isRSS
is false
var json = a:'-test':"123"b:"456"c:"789";var xml = rss;//output/*<?xml version="1.0" encoding="UTF-8" ?><a test="123"> <b>456</b> <c>789</c></a>*/ //If you want to generate RSS:var xml = rss;//output/*<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0"> <a test="123"> <b>456</b> <c>789</c> </a></rss>*/ //You can also use callback, for example:rss;
requestHTTP
**Prototype : **
requestHTTP = function(url
, callback
)
callback
is necessary
This function is convenient for debug.
However it is NOT recommended for production environment.
Features
- High performance
- Simple
- Openness