A valiant effort to parse valid HTML5 documents into XML as defined by W3C HTML Syntax.
fanr install -r http://pods.fantomfactory.org/fanr/ afHtmlParser
HTML Parser currently recognises and supports:
HTML Parser
Elements:
<div></div>
<br>
<foreignElement />
<script> ... </script>
<textarea> ... </textarea>
Attributes:
<input disabled>
<input type=submit>
<input type="submit">
Other:
<?xml version="1.0" ?>
<!DOCTYPE html >
<!-- comment -->
<![CDATA[ cdata ]]>
 
 
HTML Parser because only Chuck Norris can parse HTML with regular expressions.
class Example { Void main() { elem := HtmlParser().parseDoc("<input disabled value=wotever>") echo(elem.writeToStr) // --> <input disabled='disabled' value='wotever'/> } }
1 class - 1 method - 1 argument - 1 return value. It's pretty self explanatory!
While HTML Parser is more lenient than a validator it does NOT attempt to reconstruct documents from the tag soup of badly formatted HTML4 documents.
It's main purpose is to parse HTML5 documents created with Slim into XML so they may be tested by Bounce and Sizzle.
HTML Parser uses Pegger because HTML can not be parsed with regular expressions.
Note that Bounce has been updated to make use of HTML Parser when parsing HTTP responses of content type text/html.
text/html
Have fun!
Login or Signup to reply.
SlimerDude Fri 26 Sep 2014
HTML Parser Preview Release!
A valiant effort to parse valid HTML5 documents into XML as defined by W3C HTML Syntax.
HTML Parser
currently recognises and supports:Elements:
<div></div>
<br>
<foreignElement />
<script> ... </script>
<textarea> ... </textarea>
Attributes:
<input disabled>
<input type=submit>
<input type="submit">
Other:
<?xml version="1.0" ?>
<!DOCTYPE html >
<!-- comment -->
<![CDATA[ cdata ]]>
 
and 
Quick Start
Usage
1 class - 1 method - 1 argument - 1 return value. It's pretty self explanatory!
While
HTML Parser
is more lenient than a validator it does NOT attempt to reconstruct documents from the tag soup of badly formatted HTML4 documents.It's main purpose is to parse HTML5 documents created with Slim into XML so they may be tested by Bounce and Sizzle.
HTML Parser
uses Pegger because HTML can not be parsed with regular expressions.Note that Bounce has been updated to make use of HTML Parser when parsing HTTP responses of content type
text/html
.Have fun!