[Pkg-javascript-commits] [ltx] 224/469: disable sax_easysax because it cannot be pushed to

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:03:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository ltx.

commit 29d0cc24d43fd744a649c8eadc36f53ea1cefac6
Author: Astro <astro at spaceboyz.net>
Date:   Tue Mar 20 03:00:07 2012 +0100

    disable sax_easysax because it cannot be pushed to
---
 lib/parse.js       |  2 +-
 lib/sax_easysax.js |  5 ++++-
 package.json       |  3 ++-
 test/parse-test.js | 29 +++++++++++++++++++++++++++--
 4 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/lib/parse.js b/lib/parse.js
index 293f238..6b37684 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -3,7 +3,7 @@ var util = require('util');
 
 exports.availableSaxParsers = [];
 exports.bestSaxParser = null;
-['./sax_expat.js', './sax_easysax.js', /*'./sax_node-xml.js',*/ './sax_saxjs.js'].forEach(function(modName) {
+['./sax_expat.js', /*'./sax_easysax.js',*/ /*'./sax_node-xml.js',*/ './sax_saxjs.js'].forEach(function(modName) {
     var mod;
     try {
 	mod = require(modName);
diff --git a/lib/sax_easysax.js b/lib/sax_easysax.js
index 510669e..a8b7f60 100644
--- a/lib/sax_easysax.js
+++ b/lib/sax_easysax.js
@@ -2,6 +2,9 @@ var util = require('util');
 var events = require('events');
 var Easysax = require('easysax');
 
+/**
+ * FIXME: This SAX parser cannot be pushed to!
+ */
 var SaxEasysax = module.exports = function SaxEasysax() {
     events.EventEmitter.call(this);
     this.parser = new Easysax();
@@ -38,5 +41,5 @@ SaxEasysax.prototype.write = function(data) {
 
 SaxEasysax.prototype.end = function(data) {
     if (data)
-	this.parser.parse(data);
+	this.write(data);
 };
diff --git a/package.json b/package.json
index ea8463b..b01c795 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,6 @@
 ,"description": "<xml for=\"node.js\">"
 ,"author": "Stephan Maka"
 ,"dependencies": {"node-expat": ">=1.2.0"
-		 ,"easysax": ">=0.1.7"
 		 }
 ,"repositories": [{"type": "git"
 		  ,"path": "http://github.com/astro/ltx.git"
@@ -20,6 +19,8 @@
 ,"licenses": [{"type": "MIT"}]
 ,"engine": "node"
 ,"devDependencies": {"vows": ">=0.5.12"
+		    ,"easysax": ">=0.1.7"
+		    ,"node-xml", ">=1.0.1"
 		    ,"sax": "0.3.5"
 		    ,"Strophe.js": "https://github.com/metajack/strophejs/tarball/master"
 		    ,"request-animation-frame": ">=0.1.0"
diff --git a/test/parse-test.js b/test/parse-test.js
index c510616..aaae2af 100644
--- a/test/parse-test.js
+++ b/test/parse-test.js
@@ -7,7 +7,7 @@ ltx.availableSaxParsers.forEach(function(saxParser) {
         return ltx.parse(s, saxParser);
     };
     vows.describe('ltx with ' + saxParser.name).addBatch({
-        'parsing': {
+        'DOM parsing': {
             'simple document': function() {
                 var el = parse('<root/>');
                 assert.equal(el.name, 'root');
@@ -63,6 +63,31 @@ ltx.availableSaxParsers.forEach(function(saxParser) {
                 assert.equal(el.name, 'text');
                 assert.equal(el.getText(), "Möwe");
 	    }
-        }
+        },
+	'SAX parsing': {
+	    'XMPP stream': function() {
+		var parser = new ltx.Parser(saxParser);
+		var events = [];
+		parser.on('startElement', function(name) {
+		    events.push({ start: name });
+		});
+		parser.on('endElement', function(name) {
+		    events.push({ end: name });
+		});
+		parser.on('text', function(s) {
+		    events.push({ text: s });
+		});
+		parser.write("<?xml version='1.0'?><stream:stream xmlns='jabber:client'");
+		parser.write(" xmlns:stream='http://etherx.jabber.org/streams' id='5568");
+		parser.write("90365' from='jabber.ccc.de' version='1.0' xml:lang='en'><");
+		parser.write("stream:features><starttls xmlns='urn:ietf:params:xml:ns:x");
+		parser.write("mpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-");
+		parser.write("sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</");
+		parser.write("mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms>");
+		parser.write("<register xmlns='http://jabber.org/features/iq-register'/");
+		parser.write("></stream:features>'");
+		console.log(events);
+	    }
+	}
     }).export(module);
 });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git



More information about the Pkg-javascript-commits mailing list