Permalink
Browse files

description and readme

  • Loading branch information...
1 parent c9c303d commit 70603b6b888eb0f8e4975ed68008614bcac977af @teknopaul committed Aug 15, 2011
Showing with 13 additions and 8 deletions.
  1. +7 −7 README
  2. +4 −0 lib/dom-js.js
  3. +2 −1 package.json
View
14 README
@@ -13,15 +13,15 @@ The Element object has a method toXml() which returns a String with whitespace i
Thats it (for now) no bells, no whistles.
-var DomJS = require("dom-js").DomJS;
+ var DomJS = require("dom-js").DomJS;
-var domjs = new DomJS();
+ var domjs = new DomJS();
-var string = '<xml><!-- the comment --><elem someAtt="fat &amp; red">Hello &amp; World</elem></xml>';
-domjs.parse(string, function(err, dom) {
- console.log(util.inspect(dom, false, 23));
- console.log("serializes to : " + dom.toXml());
-});
+ var string = '<xml><!-- the comment --><elem someAtt="fat &amp; red">Hello &amp; World</elem></xml>';
+ domjs.parse(string, function(err, dom) {
+ console.log(util.inspect(dom, false, 23));
+ console.log("serializes to : " + dom.toXml());
+ });
View
@@ -45,6 +45,10 @@ DomJS = function() {
};
DomJS.prototype.parse = function(string, cb) {
+ if (typeof string != 'string') {
+ cb(true, 'Data is not a string');
+ return;
+ }
var self = this;
parser = sax.parser(strict);
View
@@ -1,6 +1,7 @@
{
"name": "dom-js",
- "version": "0.1",
+ "version": "0.0.2",
+ "description" : "XML DOM based on sax",
"dependencies": {
"sax": ">=0.1.5"
},

0 comments on commit 70603b6

Please sign in to comment.