XML::DOM::Document(3)
π NAME π
okay so welcome to XML::DOM::Document(3), bestie β this is the manual page for XML::DOM::Document, aka an XML document node in XML::DOM. It's a User Contributed Perl Documentation page, and the manual name is literally XML::DOM::Document(3) if you need to cite it iykyk. π«Ά
β¨ DESCRIPTION β¨
XML::DOM::Document extends XML::DOM::Node. No cap.
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. The way that whole family tree works? iconic. π³
π METHODS π
π getDocumentElement π
This is a convenience method that allows direct access to the child node that is the root Element of the document. Basically: direct line to the main character element. πβοΈ
π getDoctype π
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. π
π getImplementation π
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. β¨
DOMExceptions:
INVALID_CHARACTER_ERRβ Raised if thetagNamedoes 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.
Parameters:
valueβ The attribute's value. SeeAttr::setValuefor details. If the value is not supplied, thespecifiedproperty is set to0.specifiedβ Whether the attribute value was specified or whether the default value was used. If not supplied, it's assumed to be1.
DOMExceptions:
INVALID_CHARACTER_ERRβ Raised if thenamedoes not conform to the XML spec.
π createProcessingInstruction (target, data) π
Creates a ProcessingInstruction node given the specified name and data strings.
Parameters:
targetβ The target part of the processing instruction.dataβ The data for the node.
DOMExceptions:
INVALID_CHARACTER_ERRβ Raised if thetargetdoes not conform to the XML spec.
π createDocumentFragment π
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 useappendChildorinsertBeforeto set theDocumentType. Even thoughdoctypewill 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.
Parameters:
elemβ The elementtagName.attrβ 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.
DOMExceptions:
INVALID_CHARACTER_ERRβ Raised if the element name (tagName) does not conform to the XML spec.
π¦ createAttlistDecl (name) π¦
Creates an AttlistDecl object.
DOMExceptions:
INVALID_CHARACTER_ERRβ 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! β οΈ
okay that's the whole manual page, bestie! source/version + date: perl v5.42.0, 2022-05-23. mwah πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-XML-DOM 1.46-160000.2.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms