SPUG: & causing problems with Parser.pm
Christopher Cavnor
christopher at cavnor.com
Thu Sep 6 08:54:55 CDT 2001
Try encoding the incoming text as so:
my $offensive_lang = "this & that";
HTML::Entities::encode_entities($offensive_lang);
print $offensive_lang;
#yields: "this & that"
XML chokes on certain entities (&,<,>) - best to replace them in unqualified input.
Cheers;
Chris
The following message was sent by "Brittingham, John" <john.brittingham at attws.com> on Thu, 6 Sep 2001 11:16:27 -0700 .
> Help..
>
> When I try to process an XML file using XML::Twig that has an "&" anywhere
> in it I get this message.
>
> undefined entity at line 23, column 79, byte 1331 at
> /usr/lib/perl5/site_perl/5.6.0/i386-linux/XML/Parser.pm line 185
>
> One of the affending XML lines is "<LI><A
> HREF="http://knowissue.entp.attws.com:6668/servlet/IsuEngine?view=detail&id;
> =2815">Equipment issues log</A>".
>
> The error is happening here "my $s_name = $module->first_child(
> 'FIX'); # get the elements
> $subproc_xml =
> $s_name->child($n, 'SUBPROC')->sprint || print "FIX not Found\n"; # get
> their text"
>
> What can I do to fix this?
>
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/
More information about the spug-list
mailing list