1 |
package Whatpm::XMLParser; |
2 |
|
3 |
## Just a wrapper for XMLParserTemp for now. |
4 |
|
5 |
sub parse_string ($$$;$) { |
6 |
require Encode; |
7 |
my $s = Encode::encode ('utf8', $_[1]); |
8 |
open my $fh, '<', \$s; |
9 |
return $_[0]->parse_byte_stream ($fh => $_[2], $_[3], charset => 'utf8'); |
10 |
} # parse_string |
11 |
|
12 |
sub parse_byte_stream ($$$;$%) { |
13 |
my $onerror = $_[3] || sub { }; |
14 |
my %opt = @_[4..$#$_]; |
15 |
require Message::DOM::XMLParserTemp; |
16 |
return Message::DOM::XMLParserTemp->parse_byte_stream |
17 |
($_[1] => $_[2]->implementation, $onerror, |
18 |
charset => $opt{charset}); |
19 |
} # parse_byte_stream |
20 |
|
21 |
1; |
22 |
## $Date:$ |