diff --git a/README.md b/README.md
index b3b01e1..f655777 100644
--- a/README.md
+++ b/README.md
@@ -115,7 +115,6 @@ Called when an error is encountered
EXAMPLE USAGE
-------------
- var util = require('util');
var xml = require("./lib/node-xml");
var parser = new xml.SaxParser(function(cb) {
@@ -126,27 +125,27 @@ EXAMPLE USAGE
});
cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
- util.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
+ console.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
});
cb.onEndElementNS(function(elem, prefix, uri) {
- util.log("<= End: " + elem + " uri="+uri + "\n");
+ console.log("<= End: " + elem + " uri="+uri + "\n");
parser.pause();// pause the parser
setTimeout(function (){parser.resume();}, 200); //resume the parser
});
cb.onCharacters(function(chars) {
- //util.log(''+chars+"");
+ //console.log(''+chars+"");
});
cb.onCdata(function(cdata) {
- util.log(''+cdata+"");
+ console.log(''+cdata+"");
});
cb.onComment(function(msg) {
- util.log(''+msg+"");
+ console.log(''+msg+"");
});
cb.onWarning(function(msg) {
- util.log(''+msg+"");
+ console.log(''+msg+"");
});
cb.onError(function(msg) {
- util.log(''+JSON.stringify(msg)+"");
+ console.log(''+JSON.stringify(msg)+"");
});
});
diff --git a/example.js b/example.js
index 654c999..9fde39f 100755
--- a/example.js
+++ b/example.js
@@ -1,4 +1,3 @@
-var util = require('util');
var xml = require("./lib/node-xml");
var parser = new xml.SaxParser(function(cb) {
@@ -9,27 +8,27 @@ var parser = new xml.SaxParser(function(cb) {
});
cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
- util.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
+ console.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
});
cb.onEndElementNS(function(elem, prefix, uri) {
- util.log("<= End: " + elem + " uri="+uri + "\n");
+ console.log("<= End: " + elem + " uri="+uri + "\n");
parser.pause();// pause the parser
setTimeout(function (){parser.resume();}, 100); //resume the parser
});
cb.onCharacters(function(chars) {
- util.log(''+chars+"");
+ console.log(''+chars+"");
});
cb.onCdata(function(cdata) {
- util.log(''+cdata+"");
+ console.log(''+cdata+"");
});
cb.onComment(function(msg) {
- util.log(''+msg+"");
+ console.log(''+msg+"");
});
cb.onWarning(function(msg) {
- util.log(''+msg+"");
+ console.log(''+msg+"");
});
cb.onError(function(msg) {
- util.log(''+JSON.stringify(msg)+"");
+ console.log(''+JSON.stringify(msg)+"");
});
});
diff --git a/lib/node-xml.js b/lib/node-xml.js
index 180a482..e58f3ec 100755
--- a/lib/node-xml.js
+++ b/lib/node-xml.js
@@ -480,7 +480,6 @@ XMLP.prototype._parseDTD = function(iB) {
}
XMLP.prototype._parseElement = function(iB) {
- util = require('util');
var iE, iDE, iNE, iRet;
var iType, strN, iLast;
@@ -795,17 +794,7 @@ SaxParser.CMNT = 9;
SaxParser.DTD_B = 10;
SaxParser.DTD_E = 11;
-SaxParser.prototype.parseFile = function(filename) { //This function will only work in the node.js environment.
- var fs = require('fs');
- var that = this;
- fs.readFile(filename, function (err, data) {
- that.parseString(data);
- });
-}
-
-
SaxParser.prototype.parseString = function(strD) {
- util = require('util');
var that = this;
var startnew = true;
if(!that.m_parser){
diff --git a/package.json b/package.json
index 7807ad7..627dea4 100644
--- a/package.json
+++ b/package.json
@@ -18,4 +18,4 @@
"type" : "git",
"url" : "git://github.com/robrighter/node-xml.git"
}
-}
\ No newline at end of file
+}