XML-SAX-Expat
view release on metacpan or search on metacpan
0.36 2003-07-04 20:25
- XML::SAX::Expat went through a thorough round of testing. A number of
bugs were found and addressed
- start_document and end_document used to get the same hash, which is
wrong
- same for start_prefix_mapping and end_prefix_mapping
- deprecated xml_decl() in favour of adding fields to start_document()
- removed some useless manipulations of the element stack
- end_dtd() now correctly passes an empty hash instead of nothing, as
wouldn't start_cdata and end_cdata
- element_decl would return XML::Parser::ContentModel objects instead of
a content model string.
- PublicId would sometimes be undef on external_entity_decl()
- added supported_features(), as well as support for
http://xml.org/sax/features/external-general-entities and
http://xml.org/sax/features/external-parameter-entities. XML::SAX::Base
or XML::SAX::ParserFactory seem to have a bug in that they don't blow
up on unsupported features. Thanks to the numerous people on the perl-xml
list that supplied patches for this.
my $expat = XML::Parser->new( ParseParamEnt => $ppe );
$expat->{__XSE} = $self;
$expat->setHandlers(
Init => \&_handle_init,
Final => \&_handle_final,
Start => \&_handle_start,
End => \&_handle_end,
Char => \&_handle_char,
Comment => \&_handle_comment,
Proc => \&_handle_proc,
CdataStart => \&_handle_start_cdata,
CdataEnd => \&_handle_end_cdata,
Unparsed => \&_handle_unparsed_entity,
Notation => \&_handle_notation_decl,
#ExternEnt
#ExternEntFin
Entity => \&_handle_entity_decl,
Element => \&_handle_element_decl,
Attlist => \&_handle_attr_decl,
Doctype => \&_handle_start_doctype,
DoctypeFin => \&_handle_end_doctype,
XMLDecl => \&_handle_xml_decl,
#-------------------------------------------------------------------#
# _handle_proc
#-------------------------------------------------------------------#
sub _handle_proc {
$_[0]->{__XSE}->_handle_start_document({}) unless $_[0]->{__XSE}->{_started};
$_[0]->{__XSE}->SUPER::processing_instruction({ Target => $_[1], Data => $_[2] });
}
#-------------------------------------------------------------------#
#-------------------------------------------------------------------#
# _handle_start_cdata
#-------------------------------------------------------------------#
sub _handle_start_cdata {
$_[0]->{__XSE}->SUPER::start_cdata( {} );
}
#-------------------------------------------------------------------#
#-------------------------------------------------------------------#
# _handle_end_cdata
#-------------------------------------------------------------------#
sub _handle_end_cdata {
$_[0]->{__XSE}->SUPER::end_cdata( {} );
}
#-------------------------------------------------------------------#
#-------------------------------------------------------------------#
# _handle_xml_decl
#-------------------------------------------------------------------#
sub _handle_xml_decl {
my $self = shift()->{__XSE};
my $version = shift;
my $encoding = shift;
( run in 0.233 second using v1.01-cache-2.11-cpan-ec4f86ec37b )