| 1 |
=head1 NAME |
| 2 |
|
| 3 |
XML::LibXML::Dtd - XML::LibXML DTD Handling |
| 4 |
|
| 5 |
=head1 SYNOPSIS |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
use XML::LibXML; |
| 10 |
|
| 11 |
$dtd = XML::LibXML::Dtd->new($public_id, $system_id); |
| 12 |
$dtd = XML::LibXML::Dtd->parse_string($dtd_str); |
| 13 |
$publicId = $dtd->getName(); |
| 14 |
$publicId = $dtd->publicId(); |
| 15 |
$systemId = $dtd->systemId(); |
| 16 |
|
| 17 |
=head1 DESCRIPTION |
| 18 |
|
| 19 |
This class holds a DTD. You may parse a DTD from either a string, or from an |
| 20 |
external SYSTEM identifier. |
| 21 |
|
| 22 |
No support is available as yet for parsing from a filehandle. |
| 23 |
|
| 24 |
XML::LibXML::Dtd is a sub-class of L<<<<<< XML::LibXML::Node >>>>>>, so all the methods available to nodes (particularly toString()) are available |
| 25 |
to Dtd objects. |
| 26 |
|
| 27 |
|
| 28 |
=head1 METHODS |
| 29 |
|
| 30 |
=over 4 |
| 31 |
|
| 32 |
=item new |
| 33 |
|
| 34 |
$dtd = XML::LibXML::Dtd->new($public_id, $system_id); |
| 35 |
|
| 36 |
Parse a DTD from the system identifier, and return a DTD object that you can |
| 37 |
pass to $doc->is_valid() or $doc->validate(). |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
my $dtd = XML::LibXML::Dtd->new( |
| 42 |
"SOME // Public / ID / 1.0", |
| 43 |
"test.dtd" |
| 44 |
); |
| 45 |
my $doc = XML::LibXML->new->parse_file("test.xml"); |
| 46 |
$doc->validate($dtd); |
| 47 |
|
| 48 |
|
| 49 |
=item parse_string |
| 50 |
|
| 51 |
$dtd = XML::LibXML::Dtd->parse_string($dtd_str); |
| 52 |
|
| 53 |
The same as new() above, except you can parse a DTD from a string. Note that |
| 54 |
parsing from string may fail if the DTD contains external parametric-entity |
| 55 |
references with relative URLs. |
| 56 |
|
| 57 |
|
| 58 |
=item getName |
| 59 |
|
| 60 |
$publicId = $dtd->getName(); |
| 61 |
|
| 62 |
Returns the name of DTD; i.e., the name immediately following the DOCTYPE |
| 63 |
keyword. |
| 64 |
|
| 65 |
|
| 66 |
=item publicId |
| 67 |
|
| 68 |
$publicId = $dtd->publicId(); |
| 69 |
|
| 70 |
Returns the public identifier of the external subset. |
| 71 |
|
| 72 |
|
| 73 |
=item systemId |
| 74 |
|
| 75 |
$systemId = $dtd->systemId(); |
| 76 |
|
| 77 |
Returns the system identifier of the external subset. |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
=back |
| 82 |
|
| 83 |
=head1 AUTHORS |
| 84 |
|
| 85 |
Matt Sergeant, |
| 86 |
Christian Glahn, |
| 87 |
Petr Pajas |
| 88 |
|
| 89 |
|
| 90 |
=head1 VERSION |
| 91 |
|
| 92 |
2.0134 |
| 93 |
|
| 94 |
=head1 COPYRIGHT |
| 95 |
|
| 96 |
2001-2007, AxKit.com Ltd. |
| 97 |
|
| 98 |
2002-2006, Christian Glahn. |
| 99 |
|
| 100 |
2006-2009, Petr Pajas. |
| 101 |
|
| 102 |
=cut |
| 103 |
|
| 104 |
|
| 105 |
=head1 LICENSE |
| 106 |
|
| 107 |
This program is free software; you can redistribute it and/or modify it under |
| 108 |
the same terms as Perl itself. |
| 109 |
|