GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  XML::DOUBLEENCODEDENTITIES (3)

.ds Aq ’

NAME

XML::DoubleEncodedEntities - unbreak XML with doubly-encoded entities

CONTENTS

DESCRIPTION

Occasionally, XML files escape into the wild with their entities encoded twice so instead of this:



    <chocolate>Green & Blacks</chocolate>



you get:



    <chocolate>Green &amp; Blacks</chocolate>



A real-world example of this problem can be seen in this failing test for a module which queries an online XML datasource:



    http://www.nntp.perl.org/group/perl.cpan.testers/2007/02/msg414642.html



(search for the text ’Arcturus’ in that page).

This module tries to fix that.

SYNOPSIS



    use XML::DoubleEncodedEntities;
   
    my $xmlfile = XML::DoubleEncodedEntities::decode($xmlfile);



Functions

    decode

This function is not exported, but can be if you wish. It takes one scalar parameter and returns a corresponding scalar, decoded if necessary.

The parameter is assumed to be a string. If its first non-whitespace characters are <, or if it contains the sequence &amp; the string is assumed to be a doubly-encoded XML document, in which case the following entities, if present, are decoded:
&
<
>
"
'

No other parameters are decoded. After all, if the input document has been *doubly* encoded then something like ae, which should be the entity æ will be represented by the character sequence &aelig;. Once the & has been corrected by this module, you’ll be able to decode the resulting æ in the normal way.

BUGS and FEEDBACK

I welcome feedback about my code, including constructive criticism. Bug reports should be made using <http://rt.cpan.org/> or by email, and should include the smallest possible chunk of code, along with any necessary data, which demonstrates the bug. Ideally, this will be in the form of a file which I can drop in to the module’s test suite. Ideally such files will work in perl 5.004.

If you are feeling particularly generous you can encourage me in my open source endeavours by buying me something from my wishlist:
<http://www.cantrell.org.uk/david/wishlist/>

SEE ALSO

Encode::DoubleEncodedUTF8, which does the same job for broken UTF-8.

Test::DoubleEncodedEntities, which is HTMLish.

AUTHOR

David Cantrell <david@cantrell.org.uk>

COPYRIGHT and LICENCE

Copyright 2007 David Cantrell

This module is free-as-in-speech software, and may be used, distributed, and modified under the same terms as Perl itself.

CONSPIRACY

This module is also free-as-in-mason software.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 XML::DOUBLEENCODEDENTITIES (3) 2015-03-22

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.