AnewtXMLDomElement Class Reference

Element DOM node. More...

List of all members.

Public Member Functions

 __construct ($tag_name, $attributes=null)
 Create a new document element.
Attribute methods
 has_attributes ()
 Return whether this element has attributes.
 has_attribute ($name)
 Check whether this element has the given attribute.
 get_attribute ($name)
 Get value for the given attribute.
 set_attribute ($name, $value)
 Set value for the given attribute.
 get_attributes ()
 Get all attribute names and values.
 set_attributes ($attributes)
 Set multiple attributes at once.
 remove_attribute ($name)
 Remove the given attribute from this element.
Node methods
 append_child_text ($text)
 Append a text node.
 append_child_raw ($data)
 Append a raw text node.

Public Attributes

 $node_type = ANEWT_XML_DOM_ELEMENT_NODE
 The node type.
 $render_as_block = true
 Whether this element should be rendered as a block (the default).
 $always_render_closing_tag = false
 Whether the closing tag for this element should always be rendered in full instead of using shorthand notation.

Protected Attributes

 $_attributes = array()
 Hash of all attributes.

Rendering methods

 render ($indent_level=0)
 Render this element to a string.
 _build_attribute_string ()
 Build an attribute string for this element.


Detailed Description

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.

Definition at line 862 of file dom.lib.php.


Constructor & Destructor Documentation

AnewtXMLDomElement::__construct ( tag_name,
attributes = null 
)

Create a new document element.

Parameters:
$tag_name The tag name for this element
$attributes Associative array with initial attribute values for this element (optional). This parameter is for convenience only; you can always set attributes later.
See also:
set_attribute

set_attributes

Reimplemented in AnewtXHTMLElement.

Definition at line 898 of file dom.lib.php.


Member Function Documentation

AnewtXMLDomElement::has_attributes (  ) 

Return whether this element has attributes.

Returns:
True if the element has attributes; false otherwise.

Definition at line 919 of file dom.lib.php.

AnewtXMLDomElement::has_attribute ( name  ) 

Check whether this element has the given attribute.

Parameters:
$name The attribute name to test.
Returns:
True if the element has the given attribute; false otherwise.

Definition at line 933 of file dom.lib.php.

AnewtXMLDomElement::get_attribute ( name  ) 

Get value for the given attribute.

The attribute must be set for this method to succeed.

Parameters:
$name The name of attribute to retrieve the value for.
Returns:
The value of the given attribute.
See also:
get_attributes

set_attribute

Definition at line 954 of file dom.lib.php.

AnewtXMLDomElement::set_attribute ( name,
value 
)

Set value for the given attribute.

Parameters:
$name The name of attribute for which to set the value.
$value The value of the attribute.
See also:
get_attribute

set_attributes

Definition at line 974 of file dom.lib.php.

AnewtXMLDomElement::get_attributes (  ) 

Get all attribute names and values.

Returns:
Associative array with all attribute names and values.
See also:
get_attribute

set_attributes

Definition at line 995 of file dom.lib.php.

AnewtXMLDomElement::set_attributes ( attributes  ) 

Set multiple attributes at once.

This is a convenience method.

Parameters:
$attributes Associative array of attributes.
See also:
set_attribute

get_attributes

Definition at line 1011 of file dom.lib.php.

AnewtXMLDomElement::remove_attribute ( name  ) 

Remove the given attribute from this element.

This function does nothing if the attribute was not set.

Parameters:
$name The name of attribute to remove.

Definition at line 1026 of file dom.lib.php.

AnewtXMLDomElement::append_child_text ( text  ) 

Append a text node.

Parameters:
$text The text to append.
See also:
AnewtXMLDomNode::append_child

AnewtXMLDomElement::append_child_raw

Definition at line 1049 of file dom.lib.php.

AnewtXMLDomElement::append_child_raw ( data  ) 

Append a raw text node.

Parameters:
$data The raw text to append.
See also:
AnewtXMLDomNode::append_child

AnewtXMLDomElement::append_child_raw

Definition at line 1063 of file dom.lib.php.

AnewtXMLDomElement::_build_attribute_string (  )  [private]

Build an attribute string for this element.

Returns:
String containing name=value pairs.

Definition at line 1080 of file dom.lib.php.

AnewtXMLDomElement::render ( indent_level = 0  ) 

Render this element to a string.

Parameters:
$indent_level The indentation level to use for block level elements. Don't specify this attribute when calling this method, it's useful for internal purposes only.
Returns:
Rendered string with XML data.

Reimplemented in AnewtXHTMLListBase.

Definition at line 1108 of file dom.lib.php.


Member Data Documentation

AnewtXMLDomElement::$node_type = ANEWT_XML_DOM_ELEMENT_NODE

The node type.

See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1060184317

Reimplemented from AnewtXMLDomNode.

Definition at line 864 of file dom.lib.php.

AnewtXMLDomElement::$_attributes = array() [protected]

Hash of all attributes.

See also:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-84CF096

Reimplemented from AnewtXMLDomNode.

Definition at line 865 of file dom.lib.php.

AnewtXMLDomElement::$render_as_block = true

Whether this element should be rendered as a block (the default).

If false, the element is rendered inline, without indentation and surrounding newlines.

Reimplemented in AnewtXHTMLBlockElement, and AnewtXHTMLInlineElement.

Definition at line 872 of file dom.lib.php.

AnewtXMLDomElement::$always_render_closing_tag = false

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.

Reimplemented in AnewtXHTMLElement, AnewtXHTMLInput, AnewtXHTMLButton, AnewtXHTMLLink, AnewtXHTMLBase, AnewtXHTMLImage, AnewtXHTMLMeta, and AnewtXHTMLBreak.

Definition at line 879 of file dom.lib.php.


The documentation for this class was generated from the following file:

Generated on Sun Aug 2 22:54:38 2009 for Anewt by  doxygen 1.5.9