Class JSimpleXMLElement

Description

SimpleXML Element

This object stores all of the direct children of itself in the $children array. They are also stored by type as arrays. So, if, for example, this tag had 2 <font> tags as children, there would be a class member called $font created as an array. $font[0] would be the first font tag, and $font[1] would be the second.

To loop through all of the direct children of this object, the $children member should be used.

To loop through all of the direct children of a specific tag for this object, it is probably easier to use the arrays of the specific tag names, as explained above.

Located in /libraries/joomla/utilities/simplexml.php (line 454)

JObject
   |
   --JSimpleXMLElement
Variable Summary
array $_attributes
array $_children
string $_data
int $_level
string $_name
Method Summary
JSimpleXMLElement __construct (string $name, [array $attrs = array()], [integer $level = 0])
void addAttribute (string $name, array $value)
JSimpleXMLElement addChild (string $name, [array $attrs = array()], [integer $level = null])
mixed attributes ([string $attribute = null])
array children ()
string data ()
integer level ()
void map (string $callback, [array $args = array()])
string name ()
void removeAttribute (string $name)
void removeChild (JSimpleXmlElement &$child)
string setData (string $data)
string toString ([boolean $whitespace = true])
Variables
array $_attributes = array() (line 462)

Array with the attributes of this XML element

  • since: 11.1
  • access: public
array $_children = array() (line 486)

Array of references to the objects of all direct children of this XML object

  • since: 11.1
  • access: public
string $_data = '' (line 478)

The data the element contains

  • since: 11.1
  • access: public
int $_level = 0 (line 494)

The level of this XML element

  • since: 11.1
  • access: public
string $_name = '' (line 470)

The name of the element

  • since: 11.1
  • access: public

Inherited Variables

Inherited from JObject

JObject::$_errors
Methods
Constructor __construct (line 506)

Constructor, sets up all the default values

  • deprecated: 12.1 Use SimpleXMLElement
  • since: 11.1
  • access: public
JSimpleXMLElement __construct (string $name, [array $attrs = array()], [integer $level = 0])
  • string $name: The name of the element.
  • array $attrs: A key-value array (optional) of the attributes for the element.
  • integer $level: The level (optional) of the element.

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.
addAttribute (line 642)

Adds an attribute to the element

  • deprecated: 12.1
  • since: 11.1
  • access: public
void addAttribute (string $name, array $value)
  • string $name: The key
  • array $value: The value for the key
addChild (line 681)

Adds a direct child to the element

  • return: The added child object
  • deprecated: 12.1
  • since: 11.1
  • access: public
JSimpleXMLElement addChild (string $name, [array $attrs = array()], [integer $level = null])
  • string $name: The name of the element.
  • array $attrs: An key-value array of the element attributes.
  • integer $level: The level of the element (optional).
attributes (line 549)

Get the an attribute of the element

  • return: If an attribute is given will return the attribute if it exist. If no attribute is given will return the complete attributes array
  • deprecated: 12.1
  • since: 11.1
  • access: public
mixed attributes ([string $attribute = null])
  • string $attribute: The name of the attribute
children (line 607)

Get the children of the element

  • deprecated: 12.1
  • since: 11.1
  • access: public
array children ()
data (line 571)

Get the data of the element

  • deprecated: 12.1 Use SimpleXMLElement
  • since: 11.1
  • access: public
string data ()
getElementByPath (line 758)

Get an element in the document by / separated path

  • deprecated: 12.1
  • since: 11.1
  • access: public
object JSimpleXMLElement getElementByPath (string $path)
  • string $path: The / separated path to the element
level (line 623)

Get the level of the element

  • deprecated: 12.1
  • since: 11.1
  • access: public
integer level ()
map (line 804)

Traverses the tree calling the $callback(JSimpleXMLElement $this, mixed $args=array()) function with each JSimpleXMLElement.

  • deprecated: 12.1
  • since: 11.1
  • access: public
void map (string $callback, [array $args = array()])
  • string $callback: Function name
  • array $args: The arguments (optional) for the function callback.
name (line 530)

Get the name of the element

  • deprecated: 12.1
  • since: 11.1
  • access: public
string name ()
removeAttribute (line 661)

Removes an attribute from the element

  • deprecated: 12.1
  • since: 11.1
  • access: public
void removeAttribute (string $name)
  • string $name: The name of the attribute.
removeChild (line 723)

Remove the child node.

  • deprecated: 12.1
  • since: 11.1
  • access: public
void removeChild (JSimpleXmlElement &$child)
  • JSimpleXmlElement &$child: The child element to remove.
setData (line 590)

Set the data of the element

  • deprecated: 12.1 Use SimpleXMLElement
  • since: 11.1
  • access: public
string setData (string $data)
  • string $data: The CDATA for the element.
toString (line 830)

Return a well-formed XML string based on SimpleXML element

  • deprecated: 12.1
  • since: 11.1
  • access: public
string toString ([boolean $whitespace = true])
  • boolean $whitespace: True if whitespace should be prepended to the string

Redefinition of:
JObject::toString()
Converts the object to a string (the class name).

Inherited Methods

Inherited From JObject

JObject::__construct()
JObject::def()
JObject::get()
JObject::getError()
JObject::getErrors()
JObject::getProperties()
JObject::set()
JObject::setError()
JObject::setProperties()
JObject::toString()
JObject::__toString()

Documentation generated on Mon, 25 Jun 2012 13:59:37 -0500 by phpDocumentor 1.4.4