++ed by:
1 non-PAUSE user
Author image Brendt Wohlberg

NAME

XML::DTD::EntityManager - Perl module for managing entity declarations in a DTD

SYNOPSIS

  use XML::DTD::EntityManager;

  my $em = XML::DTD::EntityManager->new;

DESCRIPTION

XML::DTD::EntityManager is a Perl module for managing entity declarations in a DTD. The following methods are provided.

new
 my $em = XML::DTD::EntityManager->new;

Construct a new XML::DTD::EntityManager object.

isa
 if (XML::DTD::EntityManager->isa($obj) {
 ...
 }

Test object type.

insert
 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.

insertpe
 my $ent = XML::DTD::Entity->new('<!ENTITY % a "b">');
 $em->insertpe($ent);

Insert a parameter entity declaration.

pevalue
 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.

insertge
 my $ent = XML::DTD::Entity->new('<!ENTITY a "b">');
 $em->insertge($ent);

Insert a general entity declaration.

gevalue
 my $val = $em->gevalue('&a;');

Lookup a general entity value.

May also be called as:

 my $val = $em->gevalue('a');

with the same effect.

cevalue
 my $txt = $em->cevalue('&#x3c;');

Convert a character entity declaration. The example returns the character <.

May also be called as:

 my $val = $em->peexpand('x3c');

with the same effect.

peexpand
 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.

entitysubst
 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/)

SEE ALSO

XML::DTD, XML::DTD::Entity

AUTHOR

Brendt Wohlberg <wohl@cpan.org>

COPYRIGHT AND LICENSE

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.

ACKNOWLEDGMENTS

Peter Lamb <Peter.Lamb@csiro.au> added fetching of external entities and improved entity substitution.