[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TV] XML Parsing
On Thu, May 01, 2003 at 11:31:15AM +0100, Andrew Flegg wrote:
> In list.comp.tv, worm wrote:
> >
> > I'm using Perl (because it is available on the system) and XML::Simple
> > seems to do pretty much what I want, but it's failing on a few of the
> > 'special' characters, like pound signs and accented characters etc.
>
> The XML files are now encoded using HTML::Entities which means the
> special characters are converted into character entities of the form
> £ (for, say, a pound sign). This is necessary to get the XML to be
> valid.
That's great because I was having problems with that and had to botch
the parser to get it working.
>
> > Am I just being stupid, or do I have to filter the files first to get them
> > to work ok?
>
> Assuming you've got a string containing, say, the programme title then
> the following is the kind of code you should be looking at:
>
> #!/usr/bin/perl -w
> use strict;
> use HTML::Entities;
>
> my $title = 'Big £££ Giveaway';
> print decode_entities($title);
> exit;
>
> Of course, if it's not a case that the special characters are coming out
> as '&....;' then that probably won't help and we'll need more details
> ;-)
>
> Cheers,
>
> Andrew
>
> --
> Andrew Flegg -- mailto:andrew@xxxxxxxx | http://www.bleb.org/
>
>
> ----------------------------------------------------------------------
> Distributed to the bleb.org/tv developer list.
> Archive available at: http://www.bleb.org/tv2/maillist/
>
> To unsubscribe, send 'UNSUBSCRIBE bleb@xxxxxxxxxx' to
> mailto:tvdevel-request@xxxxxxxxx If you have any problems please contact
> mailto:listmaster@xxxxxxxx
>
>
--
--------------------------------------------------------------------
Dr Zahid Malik Tel: +44 (0) 20 7594 6336
Research Fellow Fax: +44 (0) 20 7581 4419
Dept. of Electrical Eng. Email: z.malik@xxxxxxxx
Imperial College http://infoeng.ee.ic.ac.uk/~malikz
Exhibition Road
London SW7 2BT