Bump version
[catagits/DOM-Tiny.git] / examples / entities.pl
CommitLineData
d6512b50 1use strict;
2use warnings;
3use HTTP::Tiny;
4use DOM::Tiny;
5use Encode 'decode';
6
7# Extract named character references from HTML Living Standard
8my $res = HTTP::Tiny->new->get('https://html.spec.whatwg.org');
9my $dom = DOM::Tiny->new(decode 'UTF-8', $res->{content});
10my $rows = $dom->find('#named-character-references-table tbody > tr');
11for my $row ($rows->each) {
12 my $entity = $row->at('td > code')->text;
13 my $codepoints = $row->children('td')->[1]->text;
14 print "$entity $codepoints\n";
15}
16
171;