Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1045118]
Approved by Happy-the-monk
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2017-09-24 16:02 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (274 votes). Check out past polls.