| XML-DTD documentation | view source | Contained in the XML-DTD distribution. |
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.
May also be called as:
my $val = $em->gevalue('a');
with the same effect.
my $txt = $em->cevalue('<');
Convert a character entity declaration. The example returns the
character <.
May also be called as:
my $val = $em->peexpand('x3c');
with the same effect.
my $val = $em->peexpand('%a;');
Lookup a parameter entity declaration and return its expansion as in pevalue if it exists, otherwise return the peref.
May also be called as:
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.
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/)
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.
| XML-DTD documentation | view source | Contained in the XML-DTD distribution. |