diff --git a/lib/node-xml.js b/lib/node-xml.js index 672c44d..4a1e72f 100755 --- a/lib/node-xml.js +++ b/lib/node-xml.js @@ -234,33 +234,41 @@ XMLP.prototype._parse = function() { return XMLP._NONE; } + function _indexOf(needle, haystack, start) { + // This is an improvement over the native indexOf because it stops at the + // end of the needle and doesn't continue to the end of the haystack looking. + for(var i = 0; i < needle.length; i++) { + if(needle.charAt(i) != haystack.charAt(start + i)) + return -1; + } + return start; + } + var fc = this.m_xml.charAt(this.m_iP); if (fc !== '<' && fc !== '&') { - return this._parseText (this.m_iP); - } - else if(this.m_iP == this.m_xml.indexOf("