Name : perl-HTML-TagReader
| |
Version : 1.13
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp154.1.1
| Date : 2023-01-27 16:36:21
|
Group : Development/Libraries/Perl
| Source RPM : perl-HTML-TagReader-1.13-lp154.1.1.src.rpm
|
Size : 0.17 MB
| |
Packager : https://www_suse_com/
| |
Summary : Perl extension module for reading html/sgml/xml files
|
Description :
The module implements a fast and small object oriented way of processing any kind of html/sgml/xml files by tag.
The getbytoken(0) is similar to while(< >) but instead of reading lines it reads tags or tags and text.
HTML::TagReader makes it easy to keep track of the line number in a file even though you are not reading the file by line. This important if you want to implement error messages about html errors in your code.
Here is a program that list all href tags in a html file together with line numbers and column:
use HTML::TagReader; my $p=new HTML::TagReader \"file.html\"; my AATTtag; while(AATTtag = $p->gettag(1)){ if ($tag[0]=~/ href +=/i){ $tag[0]=~s/ += */=/g; print \"line: $tag[1]: col: $tag[2]: $tag[0]\ \"; } }
Here is a program that will read a html file tag wise:
use HTML::TagReader; my $p=new HTML::TagReader \"file.html\"; my AATTtag; while(AATTtag = $p->getbytoken(1)){ if ($tag[1] eq \"\"){ # 1 is tag type, e.g \"a\" for < a href=...> print \"line: $tag[2]: col: $tag[3]: not a tag (some text), \\\"$tag[0]\\\"\ \ \"; }else{ print \"line: $tag[2]: col: $tag[3]: is a tag, $tag[0]\ \ \"; } }
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-H/15.4/x86_64 |