Skip to content
This repository
Browse code

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

  • Loading branch information...
commit a47bd482e5a132dfdade70151f294b77cafd2e6d 1 parent 7b13aa9
Jan Michael Alonzo authored November 29, 2011
16  README.md
Source Rendered
@@ -112,7 +112,7 @@ Called when an error is encountered
112 112
 EXAMPLE USAGE
113 113
 -------------
114 114
 
115  
-	var sys = require('sys');
  115
+	var util = require('util');
116 116
 	var xml = require("./lib/node-xml");
117 117
 	
118 118
 	var parser = new xml.SaxParser(function(cb) {
@@ -123,27 +123,27 @@ EXAMPLE USAGE
123 123
 		
124 124
 	  });
125 125
 	  cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
126  
-	      sys.puts("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
  126
+	      util.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
127 127
 	  });
128 128
 	  cb.onEndElementNS(function(elem, prefix, uri) {
129  
-	      sys.puts("<= End: " + elem + " uri="+uri + "\n");
  129
+	      util.log("<= End: " + elem + " uri="+uri + "\n");
130 130
 	         parser.pause();// pause the parser
131 131
 	         setTimeout(function (){parser.resume();}, 200); //resume the parser
132 132
 	  });
133 133
 	  cb.onCharacters(function(chars) {
134  
-	      //sys.puts('<CHARS>'+chars+"</CHARS>");
  134
+	      //util.log('<CHARS>'+chars+"</CHARS>");
135 135
 	  });
136 136
 	  cb.onCdata(function(cdata) {
137  
-	      sys.puts('<CDATA>'+cdata+"</CDATA>");
  137
+	      util.log('<CDATA>'+cdata+"</CDATA>");
138 138
 	  });
139 139
 	  cb.onComment(function(msg) {
140  
-	      sys.puts('<COMMENT>'+msg+"</COMMENT>");
  140
+	      util.log('<COMMENT>'+msg+"</COMMENT>");
141 141
 	  });
142 142
 	  cb.onWarning(function(msg) {
143  
-	      sys.puts('<WARNING>'+msg+"</WARNING>");
  143
+	      util.log('<WARNING>'+msg+"</WARNING>");
144 144
 	  });
145 145
 	  cb.onError(function(msg) {
146  
-	      sys.puts('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
  146
+	      util.log('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
147 147
 	  });
148 148
 	});
149 149
 	
16  example.js
... ...
@@ -1,4 +1,4 @@
1  
-var sys = require('sys');
  1
+var util = require('util');
2 2
 var xml = require("./lib/node-xml");
3 3
 
4 4
 var parser = new xml.SaxParser(function(cb) {
@@ -9,27 +9,27 @@ var parser = new xml.SaxParser(function(cb) {
9 9
       
10 10
   });
11 11
   cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
12  
-      sys.puts("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
  12
+      util.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
13 13
   });
14 14
   cb.onEndElementNS(function(elem, prefix, uri) {
15  
-      sys.puts("<= End: " + elem + " uri="+uri + "\n");
  15
+      util.log("<= End: " + elem + " uri="+uri + "\n");
16 16
          parser.pause();// pause the parser
17 17
          setTimeout(function (){parser.resume();}, 100); //resume the parser
18 18
   });
19 19
   cb.onCharacters(function(chars) {
20  
-      sys.puts('<CHARS>'+chars+"</CHARS>");
  20
+      util.log('<CHARS>'+chars+"</CHARS>");
21 21
   });
22 22
   cb.onCdata(function(cdata) {
23  
-      sys.puts('<CDATA>'+cdata+"</CDATA>");
  23
+      util.log('<CDATA>'+cdata+"</CDATA>");
24 24
   });
25 25
   cb.onComment(function(msg) {
26  
-      sys.puts('<COMMENT>'+msg+"</COMMENT>");
  26
+      util.log('<COMMENT>'+msg+"</COMMENT>");
27 27
   });
28 28
   cb.onWarning(function(msg) {
29  
-      sys.puts('<WARNING>'+msg+"</WARNING>");
  29
+      util.log('<WARNING>'+msg+"</WARNING>");
30 30
   });
31 31
   cb.onError(function(msg) {
32  
-      sys.puts('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
  32
+      util.log('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
33 33
   });
34 34
 });
35 35
 
4  lib/node-xml.js
@@ -472,7 +472,7 @@ XMLP.prototype._parseDTD = function(iB) {
472 472
 }
473 473
 
474 474
 XMLP.prototype._parseElement = function(iB) {
475  
-    sys = require('sys');
  475
+    util = require('util');
476 476
     var iE, iDE, iNE, iRet;
477 477
     var iType, strN, iLast;
478 478
 
@@ -797,7 +797,7 @@ SaxParser.prototype.parseFile = function(filename) { //This function will only w
797 797
 
798 798
 
799 799
 SaxParser.prototype.parseString = function(strD) {
800  
-    sys = require('sys');
  800
+    util = require('util');
801 801
     var that = this;
802 802
 
803 803
     setTimeout(function(){

0 notes on commit a47bd48

Please sign in to comment.
Something went wrong with that request. Please try again.