代码拉取完成,页面将自动刷新
diff --git a/lib/XML/SAX/PurePerl.pm b/lib/XML/SAX/PurePerl.pm
--- a/lib/XML/SAX/PurePerl.pm 2006-04-24 01:20:09.000000000 +0200
+++ b/lib/XML/SAX/PurePerl.pm 2012-08-09 12:47:48.736728516 +0200
@@ -595,22 +595,23 @@ sub Comment {
my $data = $reader->data(4);
if ($data =~ /^<!--/) {
- $reader->move_along(4);
+ $reader->move_along(4); # skip comment start
+ $data = $reader->data;
+ while ($data !~ m!-->!) {
+ my $n = $reader->read_more;
+ $self->parser_error("End of data seen while looking for close comment marker", $reader)
+ unless $n;
+ $data = $reader->data;
+ }
+
my $comment_str = '';
- while (1) {
- my $data = $reader->data;
- $self->parser_error("End of data seen while looking for close comment marker", $reader)
- unless length($data);
- if ($data =~ /^(.*?)-->/s) {
- $comment_str .= $1;
- $self->parser_error("Invalid comment (dash)", $reader) if $comment_str =~ /-$/;
- $reader->move_along(length($1) + 3);
- last;
- }
- else {
- $comment_str .= $data;
- $reader->move_along(length($data));
- }
+ if ($data =~ /^(.*?)-->/s) {
+ $comment_str = $1;
+ $self->parser_error("Invalid comment (dash)", $reader) if $comment_str =~ /-$/;
+ $reader->move_along(length($1) + 3);
+ }
+ else {
+ return 0;
}
$self->comment({ Data => $comment_str });
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。