|
From: <las...@us...> - 2007-10-28 16:49:56
|
Revision: 1809
http://cogkit.svn.sourceforge.net/cogkit/?rev=1809&view=rev
Author: laszewsk
Date: 2007-10-28 09:49:52 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
more code restructuring
Added Paths:
-----------
trunk/cyberaide/lib/js/json2xml.js
trunk/cyberaide/lib/js/xml2json.js
trunk/cyberaide/src/js/securelogin/cogkit/CoGHandler.js
Removed Paths:
-------------
trunk/cyberaide/src/js/securelogin/cogkit/json2xml.js
trunk/cyberaide/src/js/securelogin/cogkit/response.jsp
trunk/cyberaide/src/js/securelogin/cogkit/sample.js
trunk/cyberaide/src/js/securelogin/cogkit/xml2json.js
Copied: trunk/cyberaide/lib/js/json2xml.js (from rev 1808, trunk/cyberaide/src/js/securelogin/cogkit/json2xml.js)
===================================================================
--- trunk/cyberaide/lib/js/json2xml.js (rev 0)
+++ trunk/cyberaide/lib/js/json2xml.js 2007-10-28 16:49:52 UTC (rev 1809)
@@ -0,0 +1,45 @@
+/* This work is licensed under Creative Commons GNU LGPL License.
+
+ License: http://creativecommons.org/licenses/LGPL/2.1/
+ Version: 0.9
+ Author: Stefan Goessner/2006
+ Web: http://goessner.net/
+*/
+function json2xml(o, tab) {
+ var toXml = function(v, name, ind) {
+ var xml = "";
+ if (v instanceof Array) {
+ for (var i=0, n=v.length; i<n; i++)
+ xml += ind + toXml(v[i], name, ind+"\t") + "\n";
+ }
+ else if (typeof(v) == "object") {
+ var hasChild = false;
+ xml += ind + "<" + name;
+ for (var m in v) {
+ if (m.charAt(0) == "@")
+ xml += " " + m.substr(1) + "=\"" + v[m].toString() + "\"";
+ else
+ hasChild = true;
+ }
+ xml += hasChild ? ">" : "/>";
+ if (hasChild) {
+ for (var m in v) {
+ if (m == "#text")
+ xml += v[m];
+ else if (m == "#cdata")
+ xml += "<![CDATA[" + v[m] + "]]>";
+ else if (m.charAt(0) != "@")
+ xml += toXml(v[m], m, ind+"\t");
+ }
+ xml += (xml.charAt(xml.length-1)=="\n"?ind:"") + "</" + name + ">";
+ }
+ }
+ else {
+ xml += ind + "<" + name + ">" + v.toString() + "</" + name + ">";
+ }
+ return xml;
+ }, xml="";
+ for (var m in o)
+ xml += toXml(o[m], m, "");
+ return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, "");
+}
Copied: trunk/cyberaide/lib/js/xml2json.js (from rev 1808, trunk/cyberaide/src/js/securelogin/cogkit/xml2json.js)
===================================================================
--- trunk/cyberaide/lib/js/xml2json.js (rev 0)
+++ trunk/cyberaide/lib/js/xml2json.js 2007-10-28 16:49:52 UTC (rev 1809)
@@ -0,0 +1,155 @@
+/* This work is licensed under Creative Commons GNU LGPL License.
+
+ License: http://creativecommons.org/licenses/LGPL/2.1/
+ Version: 0.9
+ Author: Stefan Goessner/2006
+ Web: http://goessner.net/
+*/
+function xml2json(xml, tab) {
+ var X = {
+ toObj: function(xml) {
+ var o = {};
+ if (xml.nodeType==1) { // element node ..
+ if (xml.attributes.length) // element with attributes ..
+ for (var i=0; i<xml.attributes.length; i++)
+ o["@"+xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue||"").toString();
+ if (xml.firstChild) { // element has child nodes ..
+ var textChild=0, cdataChild=0, hasElementChild=false;
+ for (var n=xml.firstChild; n; n=n.nextSibling) {
+ if (n.nodeType==1) hasElementChild = true;
+ else if (n.nodeType==3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) textChild++; // non-whitespace text
+ else if (n.nodeType==4) cdataChild++; // cdata section node
+ }
+ if (hasElementChild) {
+ if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node ..
+ X.removeWhite(xml);
+ for (var n=xml.firstChild; n; n=n.nextSibling) {
+ if (n.nodeType == 3) // text node
+ o["#text"] = X.escape(n.nodeValue);
+ else if (n.nodeType == 4) // cdata node
+ o["#cdata"] = X.escape(n.nodeValue);
+ else if (o[n.nodeName]) { // multiple occurence of element ..
+ if (o[n.nodeName] instanceof Array)
+ o[n.nodeName][o[n.nodeName].length] = X.toObj(n);
+ else
+ o[n.nodeName] = [o[n.nodeName], X.toObj(n)];
+ }
+ else // first occurence of element..
+ o[n.nodeName] = X.toObj(n);
+ }
+ }
+ else { // mixed content
+ if (!xml.attributes.length)
+ o = X.escape(X.innerXml(xml));
+ else
+ o["#text"] = X.escape(X.innerXml(xml));
+ }
+ }
+ else if (textChild) { // pure text
+ if (!xml.attributes.length)
+ o = X.escape(X.innerXml(xml));
+ else
+ o["#text"] = X.escape(X.innerXml(xml));
+ }
+ else if (cdataChild) { // cdata
+ if (cdataChild > 1)
+ o = X.escape(X.innerXml(xml));
+ else
+ for (var n=xml.firstChild; n; n=n.nextSibling)
+ o["#cdata"] = X.escape(n.nodeValue);
+ }
+ }
+ if (!xml.attributes.length && !xml.firstChild) o = null;
+ }
+ else if (xml.nodeType==9) { // document.node
+ o = X.toObj(xml.documentElement);
+ }
+ else
+ alert("unhandled node type: " + xml.nodeType);
+ return o;
+ },
+ toJson: function(o, name, ind) {
+ var json = name ? ("\""+name+"\"") : "";
+ if (o instanceof Array) {
+ for (var i=0,n=o.length; i<n; i++)
+ o[i] = X.toJson(o[i], "", ind+"\t");
+ json += (name?":[":"[") + (o.length > 1 ? ("\n"+ind+"\t"+o.join(",\n"+ind+"\t")+"\n"+ind) : o.join("")) + "]";
+ }
+ else if (o == null)
+ json += (name&&":") + "null";
+ else if (typeof(o) == "object") {
+ var arr = [];
+ for (var m in o)
+ arr[arr.length] = X.toJson(o[m], m, ind+"\t");
+ json += (name?":{":"{") + (arr.length > 1 ? ("\n"+ind+"\t"+arr.join(",\n"+ind+"\t")+"\n"+ind) : arr.join("")) + "}";
+ }
+ else if (typeof(o) == "string")
+ json += (name&&":") + "\"" + o.toString() + "\"";
+ else
+ json += (name&&":") + o.toString();
+ return json;
+ },
+ innerXml: function(node) {
+ var s = ""
+ if ("innerHTML" in node)
+ s = node.innerHTML;
+ else {
+ var asXml = function(n) {
+ var s = "";
+ if (n.nodeType == 1) {
+ s += "<" + n.nodeName;
+ for (var i=0; i<n.attributes.length;i++)
+ s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue||"").toString() + "\"";
+ if (n.firstChild) {
+ s += ">";
+ for (var c=n.firstChild; c; c=c.nextSibling)
+ s += asXml(c);
+ s += "</"+n.nodeName+">";
+ }
+ else
+ s += "/>";
+ }
+ else if (n.nodeType == 3)
+ s += n.nodeValue;
+ else if (n.nodeType == 4)
+ s += "<![CDATA[" + n.nodeValue + "]]>";
+ return s;
+ };
+ for (var c=node.firstChild; c; c=c.nextSibling)
+ s += asXml(c);
+ }
+ return s;
+ },
+ escape: function(txt) {
+ return txt.replace(/[\\]/g, "\\\\")
+ .replace(/[\"]/g, '\\"')
+ .replace(/[\n]/g, '\\n')
+ .replace(/[\r]/g, '\\r');
+ },
+ removeWhite: function(e) {
+ e.normalize();
+ for (var n = e.firstChild; n; ) {
+ if (n.nodeType == 3) { // text node
+ if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // pure whitespace text node
+ var nxt = n.nextSibling;
+ e.removeChild(n);
+ n = nxt;
+ }
+ else
+ n = n.nextSibling;
+ }
+ else if (n.nodeType == 1) { // element node
+ X.removeWhite(n);
+ n = n.nextSibling;
+ }
+ else // any other node
+ n = n.nextSibling;
+ }
+ return e;
+ }
+ };
+ if (xml.nodeType == 9) // document node
+ xml = xml.documentElement;
+ var json = X.toJson(X.toObj(X.removeWhite(xml)), xml.nodeName, "\t");
+ return "{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}";
+}
Copied: trunk/cyberaide/src/js/securelogin/cogkit/CoGHandler.js (from rev 1808, trunk/cyberaide/src/js/securelogin/cogkit/sample.js)
===================================================================
--- trunk/cyberaide/src/js/securelogin/cogkit/CoGHandler.js (rev 0)
+++ trunk/cyberaide/src/js/securelogin/cogkit/CoGHandler.js 2007-10-28 16:49:52 UTC (rev 1809)
@@ -0,0 +1,95 @@
+PlainCOGHandler = new Handler("http://localhost:8080/sample/COGJS/xmlrpc");
+SecureCOGHandler = new Handler("https://localhost:8443/sample/COGJS/xmlrpc");
+COGHandler = null;
+
+if( window.location.protocol.indexOf("https") != -1 )//this is a https link
+ COGHandler = SecureCOGHandler;
+else
+ COGHandler = PlainCOGHandler;
+
+function Handler( serviceurl ){
+ try{
+ this.url = serviceurl;
+ this.xmlrpc = imprt("xmlrpc");
+ }catch(e){
+ alert(e);
+ throw "importing of xmlrpc module failed.";
+ }
+
+ this.executeMethods = function(methodname, args, cbname){
+ try{
+ var methods = [];
+ var cbfunc = null;
+ methods.push( methodname );
+ var service = new this.xmlrpc.ServiceProxy( this.url, methods );
+ var nargs = arguments.length - 1; //number of arguments for the method specified by methodname parameter
+ if( typeof arguments[arguments.length - 1] == "function" ){
+ //the user does not specify callback function
+ cbfunc = arguments[ arguments.length - 1 ];
+ nargs = arguments.length - 2;
+ }
+ var callstr = "service."+methodname+"(";
+
+ for( var i = 0; i < nargs; i++ ){//get and escape the arguments
+ if( i > 0 ) callstr += ",";
+ if( typeof arguments[i+1] == "string" ){
+ var str = arguments[i+1];
+ str = str.replace( /[\n|\r]/g, '\\n' ); //escape \n \r
+ str = str.replace( /\"/g, '\\\"'); //escape "
+ callstr += "\"" + str +"\"";
+ }else{
+ callstr += arguments[i+1];
+ }
+ }
+
+ if( cbfunc == null ){
+ callstr += ")";
+ }else
+ callstr += ", " + cbfunc + ");";
+
+ var rslt = eval( callstr );
+ }catch(e){
+ alert( e );
+ }
+ if( typeof rslt == "string" ) return rslt;
+ }
+}
+/*
+function old_wfhandle( wfdes ){
+ if( arguments.length == 0 ){
+ alert("You must input the workflow description");
+ return;
+ }
+ if( typeof arguments[0] != 'string' ){
+ alert("workflow description must be a string");
+ return;
+ }
+
+ try {
+ if (netscape.security.PrivilegeManager.enablePrivilege) {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
+ }
+ } catch (ex) { // eat it
+ }
+ var url = "http://127.0.0.1:8080/sample/xmlrpc";
+ var methods = ["zhguo.handler.inBound"];
+
+ var xmlrpc=null;
+ try{
+ xmlrpc = imprt("xmlrpc");
+ }catch(e){
+ alert(e);
+ throw "importing of xmlrpc module failed.";
+ }
+
+ var workflow = wfdes;
+ try{
+ var service = new xmlrpc.ServiceProxy( url, methods );
+ var from = "\"home\"", to = "\"rpc\"";
+ var rslt = service.zhguo.handler.inBound(workflow, to);
+ }catch(e){
+ alert( e );
+ }
+ return rslt;
+}
+*/
\ No newline at end of file
Deleted: trunk/cyberaide/src/js/securelogin/cogkit/json2xml.js
===================================================================
--- trunk/cyberaide/src/js/securelogin/cogkit/json2xml.js 2007-10-28 16:43:47 UTC (rev 1808)
+++ trunk/cyberaide/src/js/securelogin/cogkit/json2xml.js 2007-10-28 16:49:52 UTC (rev 1809)
@@ -1,45 +0,0 @@
-/* This work is licensed under Creative Commons GNU LGPL License.
-
- License: http://creativecommons.org/licenses/LGPL/2.1/
- Version: 0.9
- Author: Stefan Goessner/2006
- Web: http://goessner.net/
-*/
-function json2xml(o, tab) {
- var toXml = function(v, name, ind) {
- var xml = "";
- if (v instanceof Array) {
- for (var i=0, n=v.length; i<n; i++)
- xml += ind + toXml(v[i], name, ind+"\t") + "\n";
- }
- else if (typeof(v) == "object") {
- var hasChild = false;
- xml += ind + "<" + name;
- for (var m in v) {
- if (m.charAt(0) == "@")
- xml += " " + m.substr(1) + "=\"" + v[m].toString() + "\"";
- else
- hasChild = true;
- }
- xml += hasChild ? ">" : "/>";
- if (hasChild) {
- for (var m in v) {
- if (m == "#text")
- xml += v[m];
- else if (m == "#cdata")
- xml += "<![CDATA[" + v[m] + "]]>";
- else if (m.charAt(0) != "@")
- xml += toXml(v[m], m, ind+"\t");
- }
- xml += (xml.charAt(xml.length-1)=="\n"?ind:"") + "</" + name + ">";
- }
- }
- else {
- xml += ind + "<" + name + ">" + v.toString() + "</" + name + ">";
- }
- return xml;
- }, xml="";
- for (var m in o)
- xml += toXml(o[m], m, "");
- return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, "");
-}
Deleted: trunk/cyberaide/src/js/securelogin/cogkit/response.jsp
===================================================================
--- trunk/cyberaide/src/js/securelogin/cogkit/response.jsp 2007-10-28 16:43:47 UTC (rev 1808)
+++ trunk/cyberaide/src/js/securelogin/cogkit/response.jsp 2007-10-28 16:49:52 UTC (rev 1809)
@@ -1,11 +0,0 @@
-<% response.setContentType("text/xml");
-String str = "<?xml version=\"1.0\"?>";
-str += "<methodResponse>";
-str += "<params>";
-str += "<param><value><string>South</string></value></param>";
-str += "</params></methodResponse>";
-out.print( str );
- %>
-
-
-
Deleted: trunk/cyberaide/src/js/securelogin/cogkit/sample.js
===================================================================
--- trunk/cyberaide/src/js/securelogin/cogkit/sample.js 2007-10-28 16:43:47 UTC (rev 1808)
+++ trunk/cyberaide/src/js/securelogin/cogkit/sample.js 2007-10-28 16:49:52 UTC (rev 1809)
@@ -1,95 +0,0 @@
-PlainCOGHandler = new Handler("http://localhost:8080/sample/COGJS/xmlrpc");
-SecureCOGHandler = new Handler("https://localhost:8443/sample/COGJS/xmlrpc");
-COGHandler = null;
-
-if( window.location.protocol.indexOf("https") != -1 )//this is a https link
- COGHandler = SecureCOGHandler;
-else
- COGHandler = PlainCOGHandler;
-
-function Handler( serviceurl ){
- try{
- this.url = serviceurl;
- this.xmlrpc = imprt("xmlrpc");
- }catch(e){
- alert(e);
- throw "importing of xmlrpc module failed.";
- }
-
- this.executeMethods = function(methodname, args, cbname){
- try{
- var methods = [];
- var cbfunc = null;
- methods.push( methodname );
- var service = new this.xmlrpc.ServiceProxy( this.url, methods );
- var nargs = arguments.length - 1; //number of arguments for the method specified by methodname parameter
- if( typeof arguments[arguments.length - 1] == "function" ){
- //the user does not specify callback function
- cbfunc = arguments[ arguments.length - 1 ];
- nargs = arguments.length - 2;
- }
- var callstr = "service."+methodname+"(";
-
- for( var i = 0; i < nargs; i++ ){//get and escape the arguments
- if( i > 0 ) callstr += ",";
- if( typeof arguments[i+1] == "string" ){
- var str = arguments[i+1];
- str = str.replace( /[\n|\r]/g, '\\n' ); //escape \n \r
- str = str.replace( /\"/g, '\\\"'); //escape "
- callstr += "\"" + str +"\"";
- }else{
- callstr += arguments[i+1];
- }
- }
-
- if( cbfunc == null ){
- callstr += ")";
- }else
- callstr += ", " + cbfunc + ");";
-
- var rslt = eval( callstr );
- }catch(e){
- alert( e );
- }
- if( typeof rslt == "string" ) return rslt;
- }
-}
-/*
-function old_wfhandle( wfdes ){
- if( arguments.length == 0 ){
- alert("You must input the workflow description");
- return;
- }
- if( typeof arguments[0] != 'string' ){
- alert("workflow description must be a string");
- return;
- }
-
- try {
- if (netscape.security.PrivilegeManager.enablePrivilege) {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
- }
- } catch (ex) { // eat it
- }
- var url = "http://127.0.0.1:8080/sample/xmlrpc";
- var methods = ["zhguo.handler.inBound"];
-
- var xmlrpc=null;
- try{
- xmlrpc = imprt("xmlrpc");
- }catch(e){
- alert(e);
- throw "importing of xmlrpc module failed.";
- }
-
- var workflow = wfdes;
- try{
- var service = new xmlrpc.ServiceProxy( url, methods );
- var from = "\"home\"", to = "\"rpc\"";
- var rslt = service.zhguo.handler.inBound(workflow, to);
- }catch(e){
- alert( e );
- }
- return rslt;
-}
-*/
\ No newline at end of file
Deleted: trunk/cyberaide/src/js/securelogin/cogkit/xml2json.js
===================================================================
--- trunk/cyberaide/src/js/securelogin/cogkit/xml2json.js 2007-10-28 16:43:47 UTC (rev 1808)
+++ trunk/cyberaide/src/js/securelogin/cogkit/xml2json.js 2007-10-28 16:49:52 UTC (rev 1809)
@@ -1,155 +0,0 @@
-/* This work is licensed under Creative Commons GNU LGPL License.
-
- License: http://creativecommons.org/licenses/LGPL/2.1/
- Version: 0.9
- Author: Stefan Goessner/2006
- Web: http://goessner.net/
-*/
-function xml2json(xml, tab) {
- var X = {
- toObj: function(xml) {
- var o = {};
- if (xml.nodeType==1) { // element node ..
- if (xml.attributes.length) // element with attributes ..
- for (var i=0; i<xml.attributes.length; i++)
- o["@"+xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue||"").toString();
- if (xml.firstChild) { // element has child nodes ..
- var textChild=0, cdataChild=0, hasElementChild=false;
- for (var n=xml.firstChild; n; n=n.nextSibling) {
- if (n.nodeType==1) hasElementChild = true;
- else if (n.nodeType==3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) textChild++; // non-whitespace text
- else if (n.nodeType==4) cdataChild++; // cdata section node
- }
- if (hasElementChild) {
- if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node ..
- X.removeWhite(xml);
- for (var n=xml.firstChild; n; n=n.nextSibling) {
- if (n.nodeType == 3) // text node
- o["#text"] = X.escape(n.nodeValue);
- else if (n.nodeType == 4) // cdata node
- o["#cdata"] = X.escape(n.nodeValue);
- else if (o[n.nodeName]) { // multiple occurence of element ..
- if (o[n.nodeName] instanceof Array)
- o[n.nodeName][o[n.nodeName].length] = X.toObj(n);
- else
- o[n.nodeName] = [o[n.nodeName], X.toObj(n)];
- }
- else // first occurence of element..
- o[n.nodeName] = X.toObj(n);
- }
- }
- else { // mixed content
- if (!xml.attributes.length)
- o = X.escape(X.innerXml(xml));
- else
- o["#text"] = X.escape(X.innerXml(xml));
- }
- }
- else if (textChild) { // pure text
- if (!xml.attributes.length)
- o = X.escape(X.innerXml(xml));
- else
- o["#text"] = X.escape(X.innerXml(xml));
- }
- else if (cdataChild) { // cdata
- if (cdataChild > 1)
- o = X.escape(X.innerXml(xml));
- else
- for (var n=xml.firstChild; n; n=n.nextSibling)
- o["#cdata"] = X.escape(n.nodeValue);
- }
- }
- if (!xml.attributes.length && !xml.firstChild) o = null;
- }
- else if (xml.nodeType==9) { // document.node
- o = X.toObj(xml.documentElement);
- }
- else
- alert("unhandled node type: " + xml.nodeType);
- return o;
- },
- toJson: function(o, name, ind) {
- var json = name ? ("\""+name+"\"") : "";
- if (o instanceof Array) {
- for (var i=0,n=o.length; i<n; i++)
- o[i] = X.toJson(o[i], "", ind+"\t");
- json += (name?":[":"[") + (o.length > 1 ? ("\n"+ind+"\t"+o.join(",\n"+ind+"\t")+"\n"+ind) : o.join("")) + "]";
- }
- else if (o == null)
- json += (name&&":") + "null";
- else if (typeof(o) == "object") {
- var arr = [];
- for (var m in o)
- arr[arr.length] = X.toJson(o[m], m, ind+"\t");
- json += (name?":{":"{") + (arr.length > 1 ? ("\n"+ind+"\t"+arr.join(",\n"+ind+"\t")+"\n"+ind) : arr.join("")) + "}";
- }
- else if (typeof(o) == "string")
- json += (name&&":") + "\"" + o.toString() + "\"";
- else
- json += (name&&":") + o.toString();
- return json;
- },
- innerXml: function(node) {
- var s = ""
- if ("innerHTML" in node)
- s = node.innerHTML;
- else {
- var asXml = function(n) {
- var s = "";
- if (n.nodeType == 1) {
- s += "<" + n.nodeName;
- for (var i=0; i<n.attributes.length;i++)
- s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue||"").toString() + "\"";
- if (n.firstChild) {
- s += ">";
- for (var c=n.firstChild; c; c=c.nextSibling)
- s += asXml(c);
- s += "</"+n.nodeName+">";
- }
- else
- s += "/>";
- }
- else if (n.nodeType == 3)
- s += n.nodeValue;
- else if (n.nodeType == 4)
- s += "<![CDATA[" + n.nodeValue + "]]>";
- return s;
- };
- for (var c=node.firstChild; c; c=c.nextSibling)
- s += asXml(c);
- }
- return s;
- },
- escape: function(txt) {
- return txt.replace(/[\\]/g, "\\\\")
- .replace(/[\"]/g, '\\"')
- .replace(/[\n]/g, '\\n')
- .replace(/[\r]/g, '\\r');
- },
- removeWhite: function(e) {
- e.normalize();
- for (var n = e.firstChild; n; ) {
- if (n.nodeType == 3) { // text node
- if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // pure whitespace text node
- var nxt = n.nextSibling;
- e.removeChild(n);
- n = nxt;
- }
- else
- n = n.nextSibling;
- }
- else if (n.nodeType == 1) { // element node
- X.removeWhite(n);
- n = n.nextSibling;
- }
- else // any other node
- n = n.nextSibling;
- }
- return e;
- }
- };
- if (xml.nodeType == 9) // document node
- xml = xml.documentElement;
- var json = X.toJson(X.toObj(X.removeWhite(xml)), xml.nodeName, "\t");
- return "{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}";
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|