NAME

XML::DTD - Perl module for parsing XML DTDs

SYNOPSIS

use XML::DTD;

my $dtd = new XML::DTD;
open(FH,'<file.dtd');
$dtd->fread(*FH);
close(FH);
$dtd->fwrite(*STDOUT);

ABSTRACT

XML::DTD is a Perl module for parsing XML DTD files.

DESCRIPTION

XML::DTD is a Perl module for parsing XML DTDs. The following
methods are provided.
new
$dtd = new XML::DTD [ ($val) ];

Constructs a new XML::DTD object.

Its parser will be validating, and hence will make parameter entity substitutions, if the argument $val is present and has a boolean value of true.

fread
$dtd->fread(*FILEHANDLE [, $uri]);

Parse a DTD file. If the URI is passed, it is used as the URI for the document entity.

sread
$dtd->sread($string [, $uri]);

Parse DTD text in a string. If the URI is passed, it is used as the URI for the document entity.

fwrite
$dtd->fwrite(*FILEHANDLE);

Write the DTD to a file.

swrite
$string = $dtd->swrite();

Return the DTD text as a string.

fwritexml
$dtd->fwritexml(*FILEHANDLE);

Write an XML representation of the DTD to a file.

swritexml
$string = $dtd->swritexml();

Return an XML representation of the DTD text as a string.

elementnames
$elts = $dtd->elementnames;

Return an array of element names as an array reference.

element
$eltobj = $dtd->element('elementname');

Return the element object (of type XML::DTD::Element) associated with the specified name.

attlist
$attlistobj = $dtd->attlist('elementname');

Return the attribute list object (of type XML::DTD::AttList) associated with the specified name.

entman
$entmanobj = $dtd->entman;

Return the associated entity manager object (of type XML::DTD::EntityManager).

SEE ALSO

XML::DTD::Parser, XML::DTD::Element, XML::DTD::Attlist, XML::DTD::EntityManager, The XML 1.0 W3C Recommendation at http://www.w3.org/TR/REC-xml/

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.