Skip to content

MadcapJake/p6-MyHTML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTML::MyHTML

A wrapper for MyHTML an HTML parser.

Usage

First you need to install MyHTML. Then install this module via:

panda install HTML::MyHTML
zef install HTML::MyHTML

Example

HTML::MyHTML

use HTML::MyHTML;

my $html = "<div><span>HTML</span></div>";

# init
my HTML::MyHTML $parser .= new;

# parse
$parser.parse($html);

# print tree
$parser.tree.print($parser.tree.document):i;

# print span text
$parser.tree.nodes('span')[0].child.text.say;

# dispose
$parser.dispose;

HTML::MyHTML::Raw

use HTML::MyHTML::Raw;
use HTML::MyHTML::Encoding;

my $html = "<div><span>HTML</span></div>".encode;

# basic init
my $myhtml = myhtml_create();
myhtml_init($myhtml, 0, 1, 0);

# first tree init
my $tree = myhtml_tree_create();
myhtml_tree_init($tree, $myhtml);

# parse html
myhtml_parse($tree, Enc<utf-8>, $html, $html.bytes);

# release resources
myhtml_tree_destroy($tree);
myhtml_destroy($myhtml);

About

Perl 6 MyHTML wrapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages

  • Other 100.0%