Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Perl code for XML/HTML entities:

by Narend (Initiate)
on Jul 18, 2013 at 14:59 UTC ( #1045118=perlquestion: print w/ replies, xml ) Need Help??
Narend has asked for the wisdom of the Perl Monks concerning the following question:

I have this simple code and the huge problem :), using XML::Xpath like: my $xp = XML::XPath->new(xml => $xmlStr); now the string that I have is an XML generated from SQL Server query with XML Explicit.The XML String also contains the entities like XXXXxxxxxxxxe® and that registered symbol breaks the parsing. Please note that I cannot use XML::Entities as the application I am supporting does not have the module and I have a limitation to work on this environment without adding this module. Thanks for your time & help in advance.

Comment on Perl code for XML/HTML entities:
Re: Perl code for XML/HTML entities:
by Anonymous Monk on Jul 18, 2013 at 14:59 UTC
    And the question is?
      as stated "registered symbol breaks the parsing. " So if the parsing does not happen, need to fix that and I have tried HTML::Entities::numeric, but that converts everything to numeric equi, so that does not help. Therefore the question is how to read an XML as string to be fed to create my xpath object, where there are symbols in the String ? Thanks.

        This is most likely an encoding problem.

        Find out which encoding the data is in, and either declare the encoding at the top of the XML file using an XML declaration, or convert the data to UTF-8 before feeding it to the parser.

        If you're in the US/UK, the encoding is probably ISO-8859-1 (or ISO-8859-15 if the data includes the euro symbol).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-08-20 07:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (107 votes), past polls