Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Xml::Twig Question

by anniyan (Monk)
on May 11, 2006 at 13:04 UTC ( #548694=perlquestion: print w/ replies, xml ) Need Help??
anniyan has asked for the wisdom of the Perl Monks concerning the following question:

Monks when i am using the below code to run the xml file, i am getting the error due to entity though the file is well formed. How can i get rid off this.

use strict; use XML::Twig; my $twig = new XML::Twig( twig_handlers => { sec => sub { $_->set_gi('section') }, #change the element }, keep_encoding => 1, keep_spaces => 1, pretty_print => 'indented' #pr +int format ); $twig->parsefile('1.xml');
1.xml ----- <stats> <sec id="1.1">testing</sec> <sec id="1.2">&ldquo;testing&rdquo;</sec> </stats>

Regards,
Anniyan
(CREATED in HELL by DEVIL to s|EVILS|GOODS|g in WORLD)

Comment on Xml::Twig Question
Select or Download Code
Re: Xml::Twig Question
by MonkE (Hermit) on May 11, 2006 at 13:34 UTC
    It is possible that you do not have support for the HTML 4 entities &ldquo and &rdquo. You might have better luck using &#x201C and &#x201D in their place.
Re: Xml::Twig Question
by gopalr (Priest) on May 12, 2006 at 04:21 UTC

    Hi Anniyan,

    Use Document Declaration in xml file

    <!DOCTYPE stats SYSTEM "stats.dtd"> <stats> <sec id="1.1">testing</sec> <sec id="1.2">&ldquo;testing&rdquo;</sec> </stats>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://548694]
Approved by bart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2014-08-28 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls