Document DOM node.
Document DOM node.
The Document interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.
__construct() ¶Create a new DOM document instance.
These methods can used to get or set several properties of the document.
get_document_type() ¶Get the document type.
set_document_type($doctype) ¶Set the document type.
get_content_type() ¶Get the content type.
set_content_type($content_type) ¶Set the content type.
get_encoding() ¶Get the document encoding.
set_encoding($encoding) ¶Set the document encoding.
get_standalone() ¶Get whether this document is standalone.
This is a boolean value defaulting to null, which means no standalone attribute is added to the XML prolog.
Boolean or null if not set.
set_standalone($standalone) ¶Set whether this document is standalone.
These methods can be used to add new nodes to this document, or to create new nodes for this document. Note that you can also construct AnewtXMLDomNode subclasses directly.
append_child($root_element) ¶Append a child element to this document.
Documents can have only one child node (the document's root node), so this method can be called only once.
This method verrides the AnewtXMLDomNode::append_child() method to make sure there is only one top level element.
$root_elementThe root element to add.
& create_element($tagname, $attributes=null) ¶Create a new element for this document.
You should add the returned instance to the document yourself.
$tagnameThe tag name for this element
$attributesAssociative array with initial attribute values for this element (optional). This parameter is for convenience only; you can always set attributes later.
New AnewtXMLDomElement instance.
& create_text_node($data) ¶Create a text node for the given data.
You should add the returned instance to the document yourself.
$dataThe textual data for this node.
New AnewtXMLDomText instance.
& create_raw_node($data) ¶Create a raw text node for the given data.
This is useful to add XML snippets generated by other means to a DOM tree.
You should add the returned instance to the document yourself.
$dataThe textual data for this node.
New AnewtXMLDomRaw instance.
& create_comment($data) ¶Create a comment node for the given data.
You should add the returned instance to the document yourself.
$dataThe comment text.
New AnewtXMLDomComment instance.
& create_document_fragment() ¶Create a document fragment node.
You should add the returned instance to the document yourself.
New AnewtXMLDomDocumentFragment instance.
flush() ¶Flush output to the browser.
This serializes the document into a string and sends it to the browser with the specified content type.
flush_to_file($filename) ¶Flush output to a file.
This method renders the document and outputs it to the specified file.
$filenameThe filename to write the output to.
xml_declaration() [private] ¶Return the XML declaration for this document.
XML declaration string.
$node_name ¶The name of this node, depending on its type.
$document_element ¶Reference to the document element.
$render_xml_declaration [protected] ¶Whether to render the XML declaration.
This is detected automatically by default.
$_content_type [private] ¶The content type for this document.
AnewtXMLDomNode::has_child_nodes()AnewtXMLDomNode::$allowed_attributesAnewtXMLDomNode::$parent_nodeAnewtXMLDomNode::insert_before()AnewtXMLDomNode::$child_nodesAnewtXMLDomNode::$allowed_elementsAnewtXMLDomNode::$must_be_emptyAnewtXMLDomNode::remove_child()AnewtXMLDomNode::$owner_documentAnewtXMLDomNode::append_children()AnewtXMLDomNode::replace_child()AnewtXMLDomNode::is_same_node()AnewtXMLDomNode::$allows_textAnewtXMLDomNode::$_attributesAnewtXMLDomNode::create_for_value()