Subject: | Feature Request: Getting Doctype Parts |
XML::Twig has a method for setting parts of the DOCTYPE node and a
method for retrieving the whole DOCTYPE node. There is no method to
retrieve the individual parts of the DOCTYPE node from XML::Twig.
XML::Twig already stores the parts of the DOCTYPE node separately. I'm
including a patch that exposes these to the user. This will save the
user of grabbing the whole DOCTYPE node and hitting it with more code.
I'm a iffy on the method names, but I based them on similar packages
(XML::Libxml, XML::Xerces).
-- Brian J. Pugh
Subject: | XML-Twig-3.29-get_doctype_parts.diff |
diff -uNr XML-Twig-3.29.orig/Twig.pm XML-Twig-3.29/Twig.pm
--- XML-Twig-3.29.orig/Twig.pm 2007-01-22 04:38:15.000000000 -0500
+++ XML-Twig-3.29/Twig.pm 2007-04-05 11:07:34.961174900 -0400
@@ -2424,6 +2424,30 @@
$doctype->{internal} = $internal if( defined $internal);
}
+sub get_doctype_name
+ { my $t= shift;
+ my $doctype= $t->{twig_doctype} or return '';
+ return $doctype->{name} or return '';
+ }
+
+sub get_system_id
+ { my $t= shift;
+ my $doctype= $t->{twig_doctype} or return '';
+ return $doctype->{sysid} or return '';
+ }
+
+sub get_public_id
+ { my $t= shift;
+ my $doctype= $t->{twig_doctype} or return '';
+ return $doctype->{pub} or return '';
+ }
+
+sub get_internal_subset
+ { my $t= shift;
+ my $doctype= $t->{twig_doctype} or return '';
+ return $doctype->{internal} or return '';
+ }
+
# return the dtd object
sub dtd
{ my $t= shift;