HTML::Object::DOM::Declaration - HTML Object DOM DTD
use HTML::Object::DOM::Declaration; my $decl = HTML::Object::DOM::Declaration->new || die( HTML::Object::DOM::Declaration->error, "\n" );
v0.2.0
This module implements an HTTML declaration for the DOM. It inherits from HTML::Object::Declaration and HTTML::Object::DOM::Node
+---------------------------+ +---------------------------+ +-------------------------+ +--------------------------------+ | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Declaration | +---------------------------+ +---------------------------+ +-------------------------+ +--------------------------------+ | ^ | | v | +---------------------------+ | | HTML::Object::Declaration | ------------------------------------------------------------------------+ +---------------------------+
Inherits properties from its parents HTML::Object::Declaration and HTML::Object::DOM::Node
Read-only.
A string of the internal subset, or undef if there is none. Eg "<!ELEMENT foo (bar)>".
undef
See also Mozilla documentation
A string, eg "html" for <!DOCTYPE HTML>.
Always returns undef under perl.
Normally, under JavaScript, this returns s NamedNodeMap with notations declared in the DTD.
NamedNodeMap
A string, eg "-//W3C//DTD HTML 4.01//EN", empty string for HTML5.
A string, eg "http://www.w3.org/TR/html4/strict.dtd", empty string for HTML5.
Inherits methods from its parents HTML::Object::Declaration and HTML::Object::DOM::Node
Inserts a set of Node or string objects in the children list of the DocumentType's parent, just after the DocumentType object.
DocumentType
Example:
my $docType = $doc->implementation->createDocumentType("html", "", ""); my $myDoc = $doc->implementation->createDocument("", "", $docType); $docType->after($doc->createElement('html')); $myDoc->childNodes; # NodeList [<!DOCTYPE html>, <html>]
Inserts a set of Node or string objects in the children list of the DocumentType's parent, just before the DocumentType object.
my $docType = $doc->implementation->createDocumentType("html", "", ""); my $myDoc = $doc->implementation->createDocument("", "", $docType); $docType->before( $doc->createComment('<!--[if !IE]> conditional comment <![endif]-->') ); $myDoc->childNodes; # NodeList [<!--[if !IE]> conditional comment <![endif]-->, <!DOCTYPE html>]
Removes the object from its parent children list.
$doc->doctype; # "<!DOCTYPE html>' $doc->doctype->remove(); $doc->doctype; # null
Replaces the document type with a set of given nodes.
my $svg_dt = $doc->implementation->createDocumentType( 'svg:svg', '-//W3C//DTD SVG 1.1//EN', 'http://www->w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' ); $doc->doctype->replaceWith($svg_dt);
Always returns undef
Jacques Deguest <jack@deguest.jp>
Mozilla documentation
Copyright(c) 2021 DEGUEST Pte. Ltd.
All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Object
CPAN shell
perl -MCPAN -e shell install HTML::Object
For more information on module installation, please visit the detailed CPAN module installation guide.