Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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
[LanX]: marto: btw is Glasgow a safe place for yapc? heard it has one of the highest murder rates in western Europe
[LanX]: ... oh Amsterdam is worse. ..
[marto]: only when I'm bored
[LanX]: we should certainly avoid Amsterdam! ! !
[marto]: kidding. The area in question isn't great. I'd no idea these facilities existed in that part of town.

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (13)
As of 2017-12-14 15:42 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (396 votes). Check out past polls.