.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "XML::DOM::Document 3pm" .TH XML::DOM::Document 3pm "2022-10-14" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" XML::DOM::Document \- An XML document node in XML::DOM .SH "DESCRIPTION" .IX Header "DESCRIPTION" XML::DOM::Document extends XML::DOM::Node. .PP It is the main root of the \s-1XML\s0 document structure as returned by XML::DOM::Parser::parse and XML::DOM::Parser::parsefile. .PP Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of a Document, the Document interface also contains the factory methods needed to create these objects. The Node objects created have a getOwnerDocument method which associates them with the Document within whose context they were created. .SS "\s-1METHODS\s0" .IX Subsection "METHODS" .IP "getDocumentElement" 4 .IX Item "getDocumentElement" This is a convenience method that allows direct access to the child node that is the root Element of the document. .IP "getDoctype" 4 .IX Item "getDoctype" The Document Type Declaration (see DocumentType) associated with this document. For \s-1HTML\s0 documents as well as \s-1XML\s0 documents without a document type declaration this returns undef. The \s-1DOM\s0 Level 1 does not support editing the Document Type Declaration. .Sp \&\fBNot In \s-1DOM\s0 Spec\fR: This implementation allows editing the doctype. See \fIXML::DOM::ignoreReadOnly\fR for details. .IP "getImplementation" 4 .IX Item "getImplementation" The DOMImplementation object that handles this document. A \&\s-1DOM\s0 application may use objects from multiple implementations. .IP "createElement (tagName)" 4 .IX Item "createElement (tagName)" Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object. .Sp DOMExceptions: .RS 4 .IP "\(bu" 4 \&\s-1INVALID_CHARACTER_ERR\s0 .Sp Raised if the tagName does not conform to the \s-1XML\s0 spec. .RE .RS 4 .RE .IP "createTextNode (data)" 4 .IX Item "createTextNode (data)" Creates a Text node given the specified string. .IP "createComment (data)" 4 .IX Item "createComment (data)" Creates a Comment node given the specified string. .IP "createCDATASection (data)" 4 .IX Item "createCDATASection (data)" Creates a CDATASection node given the specified string. .IP "createAttribute (name [, value [, specified ]])" 4 .IX Item "createAttribute (name [, value [, specified ]])" Creates an Attr of the given name. Note that the Attr instance can then be set on an Element using the setAttribute method. .Sp \&\fBNot In \s-1DOM\s0 Spec\fR: The \s-1DOM\s0 Spec does not allow passing the value or the specified property in this method. In this implementation they are optional. .Sp Parameters: \fIvalue\fR The attribute's value. See Attr::setValue for details. If the value is not supplied, the specified property is set to 0. \fIspecified\fR Whether the attribute value was specified or whether the default value was used. If not supplied, it's assumed to be 1. .Sp DOMExceptions: .RS 4 .IP "\(bu" 4 \&\s-1INVALID_CHARACTER_ERR\s0 .Sp Raised if the name does not conform to the \s-1XML\s0 spec. .RE .RS 4 .RE .IP "createProcessingInstruction (target, data)" 4 .IX Item "createProcessingInstruction (target, data)" Creates a ProcessingInstruction node given the specified name and data strings. .Sp Parameters: \fItarget\fR The target part of the processing instruction. \fIdata\fR The data for the node. .Sp DOMExceptions: .RS 4 .IP "\(bu" 4 \&\s-1INVALID_CHARACTER_ERR\s0 .Sp Raised if the target does not conform to the \s-1XML\s0 spec. .RE .RS 4 .RE .IP "createDocumentFragment" 4 .IX Item "createDocumentFragment" Creates an empty DocumentFragment object. .IP "createEntityReference (name)" 4 .IX Item "createEntityReference (name)" Creates an EntityReference object. .SS "Additional methods not in the \s-1DOM\s0 Spec" .IX Subsection "Additional methods not in the DOM Spec" .IP "getXMLDecl and setXMLDecl (xmlDecl)" 4 .IX Item "getXMLDecl and setXMLDecl (xmlDecl)" Returns the XMLDecl for this Document or undef if none was specified. Note that XMLDecl is not part of the list of child nodes. .IP "setDoctype (doctype)" 4 .IX Item "setDoctype (doctype)" Sets or replaces the DocumentType. \&\fB\s-1NOTE\s0\fR: Don't use appendChild or insertBefore to set the DocumentType. Even though doctype will be part of the list of child nodes, it is handled specially. .IP "getDefaultAttrValue (elem, attr)" 4 .IX Item "getDefaultAttrValue (elem, attr)" Returns the default attribute value as a string or undef, if none is available. .Sp Parameters: \fIelem\fR The element tagName. \fIattr\fR The attribute name. .IP "getEntity (name)" 4 .IX Item "getEntity (name)" Returns the Entity with the specified name. .IP "createXMLDecl (version, encoding, standalone)" 4 .IX Item "createXMLDecl (version, encoding, standalone)" Creates an XMLDecl object. All parameters may be undefined. .IP "createDocumentType (name, sysId, pubId)" 4 .IX Item "createDocumentType (name, sysId, pubId)" Creates a DocumentType object. SysId and pubId may be undefined. .IP "createNotation (name, base, sysId, pubId)" 4 .IX Item "createNotation (name, base, sysId, pubId)" Creates a new Notation object. Consider using XML::DOM::DocumentType::addNotation! .IP "createEntity (parameter, notationName, value, sysId, pubId, ndata)" 4 .IX Item "createEntity (parameter, notationName, value, sysId, pubId, ndata)" Creates an Entity object. Consider using XML::DOM::DocumentType::addEntity! .IP "createElementDecl (name, model)" 4 .IX Item "createElementDecl (name, model)" Creates an ElementDecl object. .Sp DOMExceptions: .RS 4 .IP "\(bu" 4 \&\s-1INVALID_CHARACTER_ERR\s0 .Sp Raised if the element name (tagName) does not conform to the \s-1XML\s0 spec. .RE .RS 4 .RE .IP "createAttlistDecl (name)" 4 .IX Item "createAttlistDecl (name)" Creates an AttlistDecl object. .Sp DOMExceptions: .RS 4 .IP "\(bu" 4 \&\s-1INVALID_CHARACTER_ERR\s0 .Sp Raised if the element name (tagName) does not conform to the \s-1XML\s0 spec. .RE .RS 4 .RE .IP "expandEntity (entity [, parameter])" 4 .IX Item "expandEntity (entity [, parameter])" Expands the specified entity or parameter entity (if parameter=1) and returns its value as a string, or undef if the entity does not exist. (The entity name should not contain the '%', '&' or ';' delimiters.) .IP "check ( [$checker] )" 4 .IX Item "check ( [$checker] )" Uses the specified XML::Checker to validate the document. If no XML::Checker is supplied, a new XML::Checker is created. See XML::Checker for details. .IP "check_sax ( [$checker] )" 4 .IX Item "check_sax ( [$checker] )" Similar to \fBcheck()\fR except it uses the \s-1SAX\s0 interface to XML::Checker instead of the expat interface. This method may disappear or replace \fBcheck()\fR at some time. .IP "createChecker ()" 4 .IX Item "createChecker ()" Creates an XML::Checker based on the document's \s-1DTD.\s0 The \f(CW$checker\fR can be reused to check any elements within the document. Create a new XML::Checker whenever the \s-1DOCTYPE\s0 section of the document is altered!