Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

issue using use XML::DOM parser

by kprasanna_79 (Hermit)
on Jun 24, 2008 at 22:31 UTC ( [id://693838]=perlquestion: print w/replies, xml ) Need Help??

kprasanna_79 has asked for the wisdom of the Perl Monks concerning the following question:

Revered Monks,
I am using XML::DOM parser to parse the XML file, and when the input file contains characters like &,&lt,>,&quote,'the ouput to a file is just & instead of the full &

Any solution to this???I have the below link which didnt tells me much
http://perl-xml.sourceforge.net/faq/

Please advice

-Prasanna.K

Replies are listed 'Best First'.
Re: issue using use XML::DOM parser
by pc88mxer (Vicar) on Jun 24, 2008 at 22:58 UTC
    I have a feeling that XML::DOM is doing the right thing. The string & is an encoding of the character &.

    If you want to print encoded output, use the encode_entities() routine from HTML::Entities or a module that writes XML like XML::Writer.

      HTML::Entities encode_entities is not appropriate for XML, but encode_entities_numeric is.
Re: issue using use XML::DOM parser
by ikegami (Patriarch) on Jun 25, 2008 at 00:14 UTC

    You're very light on the details. How are you outputting to a file? If you're generating XML from text, you'll need to encode a few characters including &.

    Functions that return XML should return "&"
    Functions that return text should return "&"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-24 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found