<h1>NAME</h1>
<p>XML::Entities - Decode strings with XML entities</p>
<h1>SYNOPSIS</h1>
<pre><code>use XML::Entities;
$a = "Tom &amp; Jerry &copy; Warner Bros&period;";
$b = XML::Entities::decode('all', $a);
$c = XML::Entities::numify('all', $a);
# now $b is "Tom & Jerry © Warner Bros.
# and $c is "Tom &#38; Jerry &#169; Warner Bros&#46;"
# void context modifies the arguments
XML::Entities::numify('all', $a);
XML::Entities::decode('all', $a, $c);
# Now $a, $b and $c all contain the decoded string
</code></pre>
<h1>DESCRIPTION</h1>
<p>Based upon the HTML::Entities module by Gisle Aas</p>
<p>This module deals with decoding of strings with XML
character entities. The module provides two functions:</p>
<ul>
<li>decode( $entity_set, $string, ... )</li>
</ul>
<p>This routine replaces XML entities from $entity_set found in the
$string with the corresponding Unicode character. Unrecognized
entities are left alone.</p>
<p>The $entity_set can either be a name of an entity set - the selection
of which can be obtained by XML::Entities::Data::names(), or "all" for
a union, or alternatively a hashref which maps entity names (without
leading &'s) to the corresponding Unicode characters (or strings).</p>
<p>If multiple strings are provided as argument they are each decoded
separately and the same number of strings are returned.</p>
<p>If called in void context the arguments are decoded in-place.</p>
<p>Note: If your version of <code>HTML::Parser</code> was built without Unicode support, then
<code>XML::Entities</code> uses a regular expression to do the decoding, which is slower.</p>
<ul>
<li>numify( $entity_set, $string, ... )</li>
</ul>
<p>This functions converts named XML entities to numeric XML entities. It is less
robust than the <code>decode</code> function in the sense that it doesn't capture
improperly terminated entities. It behaves like <code>decode</code> in treating parameters
and returning values.</p>
<h2>XML::Entities::Data</h2>
<p>The list of entities is defined in the XML::Entities::Data module.
The list can be generated from the w3.org definition (or any other).
Check <code>perldoc XML::Entities::Data</code> for more details.</p>
<h1>SEE ALSO</h1>
<p>HTML::Entities, XML::Entities::Data</p>
<h1>COPYRIGHT</h1>
<p>Copyright 2010 Jan Oldrich Kruza <a href="mailto:sixtease@cpan.org">sixtease@cpan.org</a>. All rights reserved.</p>
<p>This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.</p>