Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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)

Replies are listed 'Best First'.
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?
jedikaiti looked at last hour of CB, saw "boos" but read "boobs"
[Discipulus]: 2 weekends ago LanX
[Lotus1]: cb is nsfw this morning
[Lotus1]: I wonder if ascii art would work in the cb....
[jedikaiti]: lolol
Tux looks up his status to find being an Abbot
[choroba]: pm-cb-g now shows the number of unread messages, commit on its way to github

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2017-09-20 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (237 votes). Check out past polls.

    Notices?