ti-htmlparser2
v3.8.0
Published
ti-htmlparser2 ==============
Downloads
6
Readme
ti-htmlparser2
Forgiving HTML/XML parser for Titanium SDK
This is a titaniumified version of htmlparser2. This is built using grunt-titaniumifier
.
Installation
A packaged CommonJS module can be found in the Releases page.
Usage overview
For the full documentation head over the original repository.
var htmlparser = require("htmlparser2");
var parser = new htmlparser.Parser({
onopentag: function(name, attribs){
if(name === "script" && attribs.type === "text/javascript"){
console.log("JS! Hooray!");
}
},
ontext: function(text){
console.log("-->", text);
},
onclosetag: function(tagname){
if(tagname === "script"){
console.log("That's it?!");
}
}
});
parser.write("Xyz <script type='text/javascript'>var foo = '<<bar>>';</ script>");
parser.end();
Outputs:
--> Xyz
JS! Hooray!
--> var foo = '<<bar>>';
That's it?!
Credits
Kudos to @fb55 for building htmlparser2 in the first place.
Humbly made by the spry ladies and gents at SMC.
License
This library, ti-htmlparser2, is free software ("Licensed Software"); you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; including but not limited to, the implied warranty of MERCHANTABILITY, NONINFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA