XML::DTD::EntityManager - Perl module for managing entity declarations in a DTD
use XML::DTD::EntityManager; my $em = XML::DTD::EntityManager->new;
XML::DTD::EntityManager is a Perl module for managing entity declarations in a DTD. The following methods are provided.
my $em = XML::DTD::EntityManager->new;
Construct a new XML::DTD::EntityManager object.
if (XML::DTD::EntityManager->isa($obj) { ... }
Test object type.
my $ent = XML::DTD::Entity->new('<!ENTITY a "b">'); $em->insert($ent);
Insert an entity declaration. This method is a wrapper which determines the type of entity and calls insertpe or insertge as appropriate.
my $ent = XML::DTD::Entity->new('<!ENTITY % a "b">'); $em->insertpe($ent);
Insert a parameter entity declaration.
my $val = $em->pevalue('%a;');
Lookup a parameter entity value. Recursively expands internal parameter and character entity references. Leaves general entity references unmodified.
May also be called as:
my $val = $em->pevalue('a');
with the same effect.
my $ent = XML::DTD::Entity->new('<!ENTITY a "b">'); $em->insertge($ent);
Insert a general entity declaration.
my $val = $em->gevalue('&a;');
Lookup a general entity value.
my $val = $em->gevalue('a');
my $txt = $em->cevalue('<');
Convert a character entity declaration. The example returns the character <.
<
my $val = $em->peexpand('x3c');
my $val = $em->peexpand('%a;');
Lookup a parameter entity declaration and return its expansion as in pevalue if it exists, otherwise return the peref.
my $val = $em->peexpand('a');
with the same effect. Note: returns %a; if there is no definition of a, even if called in this form.
%a;
a
my $txt = $em->entitysubst('abc &a; def');
Perform entity substitution in text. Recursively expands internal parameter and character entity references. Leaves general entity references unmodified.
For details see sections 4.4 XML Processor Treatment of Entities and References (http://www.w3.org/TR/2006/REC-xml-20060816/#entproc) and 4.5 Construction of Entity Replacement Text (http://www.w3.org/TR/2006/REC-xml-20060816/#intern-replacement) in Extensible Markup Language (XML) 1.0 (Fourth Edition) (http://www.w3.org/TR/2006/REC-xml-20060816/)
XML::DTD, XML::DTD::Entity
Brendt Wohlberg <wohl@cpan.org>
Copyright (C) 2004-2010 by Brendt Wohlberg
This library is available under the terms of the GNU General Public License (GPL), described in the GPL file included in this distribution.
Peter Lamb <Peter.Lamb@csiro.au> added fetching of external entities and improved entity substitution.
To install XML::DTD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::DTD
CPAN shell
perl -MCPAN -e shell install XML::DTD
For more information on module installation, please visit the detailed CPAN module installation guide.