Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Transition usage of sys to util - sys has been deprecated for a year

  • Loading branch information...
commit a47bd482e5a132dfdade70151f294b77cafd2e6d 1 parent 7b13aa9
@jmalonzo jmalonzo authored
Showing with 18 additions and 18 deletions.
  1. +8 −8 README.md
  2. +8 −8 example.js
  3. +2 −2 lib/node-xml.js
View
16 README.md
@@ -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) {
@@ -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>");
});
});
View
16 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) {
@@ -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>");
});
});
View
4 lib/node-xml.js
@@ -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;
@@ -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(){
Please sign in to comment.
Something went wrong with that request. Please try again.