http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/elementtree/node_modules/sax/examples/example.js ---------------------------------------------------------------------- diff --git a/node_modules/elementtree/node_modules/sax/examples/example.js b/node_modules/elementtree/node_modules/sax/examples/example.js deleted file mode 100644 index e7f81e6..0000000 --- a/node_modules/elementtree/node_modules/sax/examples/example.js +++ /dev/null @@ -1,41 +0,0 @@ - -var fs = require("fs"), - sys = require("sys"), - path = require("path"), - xml = fs.cat(path.join(__dirname, "test.xml")), - sax = require("../lib/sax"), - strict = sax.parser(true), - loose = sax.parser(false, {trim:true}), - inspector = function (ev) { return function (data) { - // sys.error(""); - // sys.error(ev+": "+sys.inspect(data)); - // for (var i in data) sys.error(i+ " "+sys.inspect(data[i])); - // sys.error(this.line+":"+this.column); - }}; - -xml.addCallback(function (xml) { - // strict.write(xml); - - sax.EVENTS.forEach(function (ev) { - loose["on"+ev] = inspector(ev); - }); - loose.onend = function () { - // sys.error("end"); - // sys.error(sys.inspect(loose)); - }; - - // do this one char at a time to verify that it works. - // (function () { - // if (xml) { - // loose.write(xml.substr(0,1000)); - // xml = xml.substr(1000); - // process.nextTick(arguments.callee); - // } else loose.close(); - // })(); - - for (var i = 0; i < 1000; i ++) { - loose.write(xml); - loose.close(); - } - -});
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/elementtree/node_modules/sax/examples/get-products.js ---------------------------------------------------------------------- diff --git a/node_modules/elementtree/node_modules/sax/examples/get-products.js b/node_modules/elementtree/node_modules/sax/examples/get-products.js deleted file mode 100644 index 9e8d74a..0000000 --- a/node_modules/elementtree/node_modules/sax/examples/get-products.js +++ /dev/null @@ -1,58 +0,0 @@ -// pull out /GeneralSearchResponse/categories/category/items/product tags -// the rest we don't care about. - -var sax = require("../lib/sax.js") -var fs = require("fs") -var path = require("path") -var xmlFile = path.resolve(__dirname, "shopping.xml") -var util = require("util") -var http = require("http") - -fs.readFile(xmlFile, function (er, d) { - http.createServer(function (req, res) { - if (er) throw er - var xmlstr = d.toString("utf8") - - var parser = sax.parser(true) - var products = [] - var product = null - var currentTag = null - - parser.onclosetag = function (tagName) { - if (tagName === "product") { - products.push(product) - currentTag = product = null - return - } - if (currentTag && currentTag.parent) { - var p = currentTag.parent - delete currentTag.parent - currentTag = p - } - } - - parser.onopentag = function (tag) { - if (tag.name !== "product" && !product) return - if (tag.name === "product") { - product = tag - } - tag.parent = currentTag - tag.children = [] - tag.parent && tag.parent.children.push(tag) - currentTag = tag - } - - parser.ontext = function (text) { - if (currentTag) currentTag.children.push(text) - } - - parser.onend = function () { - var out = util.inspect(products, false, 3, true) - res.writeHead(200, {"content-type":"application/json"}) - res.end("{\"ok\":true}") - // res.end(JSON.stringify(products)) - } - - parser.write(xmlstr).end() - }).listen(1337) -}) http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/elementtree/node_modules/sax/examples/hello-world.js ---------------------------------------------------------------------- diff --git a/node_modules/elementtree/node_modules/sax/examples/hello-world.js b/node_modules/elementtree/node_modules/sax/examples/hello-world.js deleted file mode 100644 index cbfa518..0000000 --- a/node_modules/elementtree/node_modules/sax/examples/hello-world.js +++ /dev/null @@ -1,4 +0,0 @@ -require("http").createServer(function (req, res) { - res.writeHead(200, {"content-type":"application/json"}) - res.end(JSON.stringify({ok: true})) -}).listen(1337) http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/elementtree/node_modules/sax/examples/not-pretty.xml ---------------------------------------------------------------------- diff --git a/node_modules/elementtree/node_modules/sax/examples/not-pretty.xml b/node_modules/elementtree/node_modules/sax/examples/not-pretty.xml deleted file mode 100644 index 9592852..0000000 --- a/node_modules/elementtree/node_modules/sax/examples/not-pretty.xml +++ /dev/null @@ -1,8 +0,0 @@ -<root> - something<else> blerm <slurm - - - attrib = - "blorg" ></else><!-- COMMENT! - ---><![CDATA[processing...]]> <selfclosing tag="blr>""/> a bit down here</root> http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1d7ccaec/node_modules/elementtree/node_modules/sax/examples/pretty-print.js ---------------------------------------------------------------------- diff --git a/node_modules/elementtree/node_modules/sax/examples/pretty-print.js b/node_modules/elementtree/node_modules/sax/examples/pretty-print.js deleted file mode 100644 index cd6aca9..0000000 --- a/node_modules/elementtree/node_modules/sax/examples/pretty-print.js +++ /dev/null @@ -1,74 +0,0 @@ -var sax = require("../lib/sax") - , printer = sax.createStream(false, {lowercasetags:true, trim:true}) - , fs = require("fs") - -function entity (str) { - return str.replace('"', '"') -} - -printer.tabstop = 2 -printer.level = 0 -printer.indent = function () { - print("\n") - for (var i = this.level; i > 0; i --) { - for (var j = this.tabstop; j > 0; j --) { - print(" ") - } - } -} -printer.on("opentag", function (tag) { - this.indent() - this.level ++ - print("<"+tag.name) - for (var i in tag.attributes) { - print(" "+i+"=\""+entity(tag.attributes[i])+"\"") - } - print(">") -}) - -printer.on("text", ontext) -printer.on("doctype", ontext) -function ontext (text) { - this.indent() - print(text) -} - -printer.on("closetag", function (tag) { - this.level -- - this.indent() - print("</"+tag+">") -}) - -printer.on("cdata", function (data) { - this.indent() - print("<![CDATA["+data+"]]>") -}) - -printer.on("comment", function (comment) { - this.indent() - print("<!--"+comment+"-->") -}) - -printer.on("error", function (error) { - console.error(error) - throw error -}) - -if (!process.argv[2]) { - throw new Error("Please provide an xml file to prettify\n"+ - "TODO: read from stdin or take a file") -} -var xmlfile = require("path").join(process.cwd(), process.argv[2]) -var fstr = fs.createReadStream(xmlfile, { encoding: "utf8" }) - -function print (c) { - if (!process.stdout.write(c)) { - fstr.pause() - } -} - -process.stdout.on("drain", function () { - fstr.resume() -}) - -fstr.pipe(printer) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
