| XML-DTD documentation | view source | Contained in the XML-DTD distribution. |
XML::DTD - Perl module for parsing XML DTDs
use XML::DTD; my $dtd = new XML::DTD; open(FH,'<file.dtd'); $dtd->fread(*FH); close(FH); $dtd->fwrite(*STDOUT);
XML::DTD is a Perl module for parsing XML DTD files.
XML::DTD is a Perl module for parsing XML DTDs. The following methods are provided.
$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.
$dtd->fread(*FILEHANDLE [, $uri]);
Parse a DTD file. If the URI is passed, it is used as the URI for the document entity.
$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.
$dtd->fwrite(*FILEHANDLE);
Write the DTD to a file.
$string = $dtd->swrite();
Return the DTD text as a string.
$dtd->fwritexml(*FILEHANDLE);
Write an XML representation of the DTD to a file.
$string = $dtd->swritexml();
Return an XML representation of the DTD text as a string.
$elts = $dtd->elementnames;
Return an array of element names as an array reference.
$eltobj = $dtd->element('elementname');
Return the element object (of type XML::DTD::Element) associated with the specified name.
$attlistobj = $dtd->attlist('elementname');
Return the attribute list object (of type XML::DTD::AttList) associated with the specified name.
$entmanobj = $dtd->entman;
Return the associated entity manager object (of type XML::DTD::EntityManager).
The DTD parser is an ugly hack, and while any valid DTD should be parsed correctly, some types of DTD errors may be ignored, and when detected, the error messages are often not very useful. In summary, use other tools, such as xmllint for checking the validity of a DTD.
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/
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. |