ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
XML::LibXML::SAX allows bad XML
by Grant McLean other posts by this author
Jan 24 2005 12:40AM messages near this date
view in the new Beta List Site
RE: Regarding Perl LibXML | Regarding Perl LibXML
& XSLT The XML::LibXML::SAX parser module doesn't seem to throw exceptions when
it encounters badly formed XML.  For example:

  package MyHandler;

  use base 'XML::SAX::Base';

  sub characters { print "Character data: '$_[1]-> {Data}'\n"; }


  package main;

  use XML::LibXML::SAX;

  my $handler = MyHandler-> new;
  my $parser  = XML::LibXML::SAX-> new(Handler => $handler);

  $parser-> parse_string('<para>one < two</para>');

Which prints:

 Character data: 'one '
 Character data: ' two'

When it ought to die on the rogue '<' character.  Other errors like
mismatched closing tags also don't trigger exceptions.

This is the default SAX parser installed into ParserDetails.ini by the
XML::LibXML Makefile.

I don't think this behaviour is new, but for some reason, I'm getting
more people reporting it to me as a bug in XML::Simple recently :-(

Anyone know if this behaviour is deliberate?

Cheers
Grant

_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved