Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lexborisov/perl-html-myhtml.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MyHTML.pm')
-rwxr-xr-xMyHTML.pm126
1 files changed, 126 insertions, 0 deletions
diff --git a/MyHTML.pm b/MyHTML.pm
index a47a699..986ff90 100755
--- a/MyHTML.pm
+++ b/MyHTML.pm
@@ -466,6 +466,42 @@ Return: array list of elements HTML::MyHTML::Tree::Node
Return: array list of elements HTML::MyHTML::Tree::Node
+=head3 callback_before_token_done_set
+
+Set callback for tokens before processing.
+
+Important!!! Only for Perl! Do not use this callback in Thread mode parsing; Build without threads or use methods parse_single, parse_fragment_single, parse_chunk_single, parse_chunk_fragment_single or create myhtml with MyHTML_OPTIONS_PARSE_MODE_SINGLE option;
+
+ $tree->callback_before_token_done_set($sub_callback [, $ctx]);
+
+
+=head3 callback_after_token_done_set
+
+Set callback for tokens after processing
+
+Important!!! Only for Perl! Do not use this callback in Thread mode parsing; Build without threads or use methods parse_single, parse_fragment_single, parse_chunk_single, parse_chunk_fragment_single or create myhtml with MyHTML_OPTIONS_PARSE_MODE_SINGLE option;
+
+ $tree->callback_after_token_done_set($sub_callback [, $ctx]);
+
+
+=head3 callback_node_insert_set
+
+Set callback for tree node after inserted
+
+Important!!! Only for Perl! Do not use this callback in Thread mode parsing; Build without threads or use methods parse_single, parse_fragment_single, parse_chunk_single, parse_chunk_fragment_single or create myhtml with MyHTML_OPTIONS_PARSE_MODE_SINGLE option;
+
+ $tree->callback_node_insert_set($sub_callback [, $ctx]);
+
+
+=head3 callback_node_remove_set
+
+Set callback for tree node after removed
+
+Important!!! Only for Perl! Do not use this callback in Thread mode parsing; Build without threads or use methods parse_single, parse_fragment_single, parse_chunk_single, parse_chunk_fragment_single or create myhtml with MyHTML_OPTIONS_PARSE_MODE_SINGLE option;
+
+ $tree->callback_node_remove_set($sub_callback [, $ctx]);
+
+
=head2 Attributes
=head3 info
@@ -599,6 +635,15 @@ Get last child of node
Return: HTML::MyHTML::Tree::Node if exists, otherwise an UNDEF value
+=head3 token
+
+Get token node
+
+ my $token_node = $node->token();
+
+Return: HTML::MyHTML::Token::Node if exists, otherwise an UNDEF value
+
+
=head3 get_nodes_by_attribute_key
Get nodes by attribute key of current node
@@ -828,6 +873,87 @@ Print tree of a node. Print including current node
$node->print_all($tree, $fh);
+=head2 Token Node
+
+=head3 info
+
+Get information of token node: tag name, tag id, attr
+
+ my $res = $token_node->info($tree);
+
+Return: hash ref
+
+
+=head3 tag_id
+
+Get token node tag id
+
+ my $tag_id = $token_node->tag_id();
+
+Return: tag_id
+
+
+=head3 tag_name
+
+Get tag name of a token node
+
+ my $res = $token_node->tag_name($tree);
+
+Return: tag name
+
+
+=head3 is_close_self
+
+Node has self-closing flag?
+
+ my $bool = $token_node->is_close_self();
+
+Return: 1 (true) or 0 (false)
+
+
+=head3 attr_first
+
+Get first attribute of a token node
+
+ my $attr = $token_node->attr_first();
+
+Return: HTML::MyHTML::Tree::Attr if exists, otherwise an UNDEF value
+
+
+=head3 attr_last
+
+Get last attribute of a token node
+
+ my $attr = $token_node->attr_last();
+
+Return: HTML::MyHTML::Tree::Attr if exists, otherwise an UNDEF value
+
+
+=head3 text
+
+Get text of a token node. Only for a MyHTML_TAG__TEXT or MyHTML_TAG__COMMENT tags
+
+ my $res = $token_node->text();
+
+Return: text if exists, otherwise an UNDEF value
+
+
+=head3 string
+
+Get myhtml_string_t object by token node
+
+ my $string = $token_node->string();
+
+Return: HTML::MyHTML::String if exists, otherwise an NULL value
+
+
+=head3 wait_for_done
+
+Wait for process token all parsing stage. Need if you use thread mode
+
+ $token_node->wait_for_done();
+
+
=head2 Detect encoding
=head3 encoding_detect