Element DOM node.
Element DOM node.
This is a node type that corresponds to an XML element (tag). Note that the attribute API does not strictly match the W3C DOM standard. Instead of using a special attribute class, a simple associative-array based approach is used. This means there is no get_attribute_node method. instead, use methods such as get_attribute instead to retrieve the (string) value of an attribute.
__construct($tag_name, $attributes=null) ¶Create a new document element.
$tag_nameThe 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.
has_attributes() ¶Return whether this element has attributes.
True if the element has attributes; false otherwise.
has_attribute($name) ¶Check whether this element has the given attribute.
$nameThe attribute name to test.
True if the element has the given attribute; false otherwise.
get_attribute($name) ¶Get value for the given attribute.
The attribute must be set for this method to succeed.
$nameThe name of attribute to retrieve the value for.
The value of the given attribute.
set_attribute($name, $value) ¶Set value for the given attribute.
$nameThe name of attribute for which to set the value.
$valueThe value of the attribute.
get_attributes() ¶Get all attribute names and values.
Associative array with all attribute names and values.
set_attributes($attributes) ¶Set multiple attributes at once.
This is a convenience method.
$attributesAssociative array of attributes.
remove_attribute($name) ¶Remove the given attribute from this element.
This function does nothing if the attribute was not set.
$nameThe name of attribute to remove.
render($indent_level=0) ¶Render this element to a string.
$indent_levelThe indentation level to use for block level elements. Don't specify this attribute when calling this method, it's useful for internal purposes only.
Rendered string with XML data.
_build_attribute_string() [private] ¶Build an attribute string for this element.
String containing name=value pairs.
$render_as_block ¶Whether this element should be rendered as a block (the default).
If false, the element is rendered inline, without indentation and surrounding newlines.
$always_render_closing_tag ¶Whether the closing tag for this element should always be rendered in full instead of using shorthand notation.
This is needed for e.g. the script tag in XHTML because of browser imcompatibilities.
$_attributes [protected] ¶Hash of all attributes.
AnewtXMLDomNode::has_child_nodes()AnewtXMLDomNode::$allowed_attributesAnewtXMLDomNode::$parent_nodeAnewtXMLDomNode::insert_before()AnewtXMLDomNode::$child_nodesAnewtXMLDomNode::$allowed_elementsAnewtXMLDomNode::$must_be_emptyAnewtXMLDomNode::remove_child()AnewtXMLDomNode::$node_nameAnewtXMLDomNode::$owner_documentAnewtXMLDomNode::append_children()AnewtXMLDomNode::replace_child()AnewtXMLDomNode::append_child()AnewtXMLDomNode::is_same_node()AnewtXMLDomNode::$allows_textAnewtXMLDomNode::__construct()AnewtXMLDomNode::create_for_value()