Navigation Menu

Skip to content

Commit

Permalink
Transition usage of sys to util - sys has been deprecated for a year
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalonzo committed Nov 29, 2011
1 parent 7b13aa9 commit a47bd48
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions README.md
Expand Up @@ -112,7 +112,7 @@ Called when an error is encountered
EXAMPLE USAGE
-------------

var sys = require('sys');
var util = require('util');
var xml = require("./lib/node-xml");

var parser = new xml.SaxParser(function(cb) {
Expand All @@ -123,27 +123,27 @@ EXAMPLE USAGE
});
cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
sys.puts("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
util.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
});
cb.onEndElementNS(function(elem, prefix, uri) {
sys.puts("<= End: " + elem + " uri="+uri + "\n");
util.log("<= End: " + elem + " uri="+uri + "\n");
parser.pause();// pause the parser
setTimeout(function (){parser.resume();}, 200); //resume the parser
});
cb.onCharacters(function(chars) {
//sys.puts('<CHARS>'+chars+"</CHARS>");
//util.log('<CHARS>'+chars+"</CHARS>");
});
cb.onCdata(function(cdata) {
sys.puts('<CDATA>'+cdata+"</CDATA>");
util.log('<CDATA>'+cdata+"</CDATA>");
});
cb.onComment(function(msg) {
sys.puts('<COMMENT>'+msg+"</COMMENT>");
util.log('<COMMENT>'+msg+"</COMMENT>");
});
cb.onWarning(function(msg) {
sys.puts('<WARNING>'+msg+"</WARNING>");
util.log('<WARNING>'+msg+"</WARNING>");
});
cb.onError(function(msg) {
sys.puts('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
util.log('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
});
});

Expand Down
16 changes: 8 additions & 8 deletions example.js
@@ -1,4 +1,4 @@
var sys = require('sys');
var util = require('util');
var xml = require("./lib/node-xml");

var parser = new xml.SaxParser(function(cb) {
Expand All @@ -9,27 +9,27 @@ var parser = new xml.SaxParser(function(cb) {

});
cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
sys.puts("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
util.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
});
cb.onEndElementNS(function(elem, prefix, uri) {
sys.puts("<= End: " + elem + " uri="+uri + "\n");
util.log("<= End: " + elem + " uri="+uri + "\n");
parser.pause();// pause the parser
setTimeout(function (){parser.resume();}, 100); //resume the parser
});
cb.onCharacters(function(chars) {
sys.puts('<CHARS>'+chars+"</CHARS>");
util.log('<CHARS>'+chars+"</CHARS>");
});
cb.onCdata(function(cdata) {
sys.puts('<CDATA>'+cdata+"</CDATA>");
util.log('<CDATA>'+cdata+"</CDATA>");
});
cb.onComment(function(msg) {
sys.puts('<COMMENT>'+msg+"</COMMENT>");
util.log('<COMMENT>'+msg+"</COMMENT>");
});
cb.onWarning(function(msg) {
sys.puts('<WARNING>'+msg+"</WARNING>");
util.log('<WARNING>'+msg+"</WARNING>");
});
cb.onError(function(msg) {
sys.puts('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
util.log('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
});
});

Expand Down
4 changes: 2 additions & 2 deletions lib/node-xml.js
Expand Up @@ -472,7 +472,7 @@ XMLP.prototype._parseDTD = function(iB) {
}

XMLP.prototype._parseElement = function(iB) {
sys = require('sys');
util = require('util');
var iE, iDE, iNE, iRet;
var iType, strN, iLast;

Expand Down Expand Up @@ -797,7 +797,7 @@ SaxParser.prototype.parseFile = function(filename) { //This function will only w


SaxParser.prototype.parseString = function(strD) {
sys = require('sys');
util = require('util');
var that = this;

setTimeout(function(){
Expand Down

0 comments on commit a47bd48

Please sign in to comment.