XML::DOM::Document − An XML document node in XML::DOM


XML::DOM::Document extends XML::DOM::Node.

It is the main root of the XML document structure as returned by XML::DOM::Parser::parse and XML::DOM::Parser::parsefile.

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.


This is a convenience method that allows direct access to the child node that is the root Element of the document.


The Document Type Declaration (see DocumentType) associated with this document. For HTML documents as well as XML documents without a document type declaration this returns undef. The DOM Level 1 does not support editing the Document Type Declaration.

Not In DOM Spec: This implementation allows editing the doctype. See XML::DOM::ignoreReadOnly for details.


The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.

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.



Raised if the tagName does not conform to the XML spec.

createTextNode (data)

Creates a Text node given the specified string.

createComment (data)

Creates a Comment node given the specified string.

createCDATASection (data)

Creates a CDATASection node given the specified string.

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.

Not In DOM Spec: The DOM Spec does not allow passing the value or the specified property in this method. In this implementation they are optional.

The attribute’s value. See Attr::setValue for details.
If the value is not supplied, the specified property is set to 0.
Whether the attribute value was specified or whether the default
value was used. If not supplied, it’s assumed to be 1.



Raised if the name does not conform to the XML spec.

createProcessingInstruction (target, data)

Creates a ProcessingInstruction node given the specified name and data strings.

The target part of the processing instruction.
The data for the node.



Raised if the target does not conform to the XML spec.


Creates an empty DocumentFragment object.

createEntityReference (name)

Creates an EntityReference object.

Additional methods not in the DOM Spec
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.

setDoctype (doctype)

Sets or replaces the DocumentType. NOTE : 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.

getDefaultAttrValue (elem, attr)

Returns the default attribute value as a string or undef, if none is available.

The element tagName.
The attribute name.

getEntity (name)

Returns the Entity with the specified name.

createXMLDecl (version, encoding, standalone)

Creates an XMLDecl object. All parameters may be undefined.

createDocumentType (name, sysId, pubId)

Creates a DocumentType object. SysId and pubId may be undefined.

createNotation (name, base, sysId, pubId)

Creates a new Notation object. Consider using XML::DOM::DocumentType::addNotation!

createEntity (parameter, notationName, value, sysId, pubId, ndata)

Creates an Entity object. Consider using XML::DOM::DocumentType::addEntity!

createElementDecl (name, model)

Creates an ElementDecl object.



Raised if the element name (tagName) does not conform to the XML spec.

createAttlistDecl (name)

Creates an AttlistDecl object.



Raised if the element name (tagName) does not conform to the XML spec.

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.)

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.

check_sax ( [$checker] )

Similar to check() except it uses the SAX interface to XML::Checker instead of the expat interface. This method may disappear or replace check() at some time.

createChecker ()

Creates an XML::Checker based on the document’s DTD . The $checker can be reused to check any elements within the document. Create a new XML::Checker whenever the DOCTYPE section of the document is altered!

More Linux Commands

vdso(7) overview of the virtual ELF dynamic shared object...
The vDSO (virtual dynamic shared object) is a small shared library that the kernel automatically maps into the address space of all user-space applications. App

gnutls_psk_allocate_server_credentials(3) - API function....
gnutls_psk_allocate_server_credentials.3 - This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it

XShapeQueryVersion(3) - X nonrectangular shape functions....
The X11 Nonrectangular Window Shape Extension adds nonrectangular windows to the X Window System. PREDEFINED VALUES Operations: ShapeSet ShapeUnion ShapeInterse

gio-querymodules(1) - GIO module cache creation (Man Page)
gio-querymodules creates a giomodule.cache file in the listed directories. This file lists the implemented extension points for each module that has been found.

xmessage(1) - display a message or query in a window (X-base
The xmessage program displays a window containing a message from the command line, a file, or standard input. Along the lower edge of the message is row of butt

Socket(3pm) - load the C socket.h defines and structure mani
This module provides a variety of constants, structure manipulators and other functions related to socket-based networking. The values and functions provided ar

perror(3) - print a system error message - Linux man page...
perror.3 - The routine perror() produces a message on the standard error output, describing the last error encountered during a call to a system or library func

strtoul(3) - convert a string to an unsigned long integer...
The strtoul() function converts the initial part of the string in nptr to an unsigned long int value according to the given base, which must be between 2 and 36

XPutPixel(3) - image utilities (Library - Linux man page)...
The XInitImage function initializes the internal image manipulation routines of an image structure, based on the values of the various structure members. All fi

cisco-decrypt(1) - decrypts an obfuscated Cisco vpn client p
This command accompanies vpnc. It decrypts the obfuscated pre-shared key from *.pcf-configuration files, which must be specified on the command line. The result

arybase(3pm) Set indexing base via - Linux manual page......
This module implements Perls $[ variable. You should not use it directly. Assigning to $[ has the compile-time effect of making the assigned value, converted to

FD_SET(3) - synchronous I/O multiplexing - Linux man page...
select() and pselect() allow a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become ready for some class of I/

We can't live, work or learn in freedom unless the software we use is free.