Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5

 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 /joomla/utilities/simplexml.php (line 357)

Class JObject   (Subpackage Base)

Class JSimpleXMLElement   (Subpackage Utilities)
Variable Summary
Variable array $_attributes
Variable array $_children
Variable string $_data
Variable int $_level
Variable string $_name
Method Summary
Constructor JSimpleXMLElement __construct (string $name, [array $attrs = array()], [ $level = 0], int $parents)
Method void addAttribute (string $name,  $value, array $attrs)
Method void addChild (string $name, array $attrs, int $level)
Method string asXML ([ $whitespace = true])
Method mixed attributes ([string $attribute = null])
Method array children ()
Method string data ()
Method int level ()
Method void map ( $callback, [ $args = array()])
Method string name ()
Method void removeAttribute (string $name)
Method void removeChild ( &$child)
Method string setData (string $data)
Variables
array $_attributes = array() (line 364)

Array with the attributes of this XML element

array $_children = array() (line 385)

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

string $_data = '' (line 378)

The data the element contains

int $_level = 0 (line 392)

The level of this XML element

string $_name = '' (line 371)

The name of the element

Methods
Constructor __construct (line 402)

Constructor, sets up all the default values

JSimpleXMLElement __construct (string $name, [array $attrs = array()],  $level, int $parents)
  • string $name
  • array $attrs
  • int $parents
  • $level

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

Adds an attribute to the element

void addAttribute (string $name,  $value, array $attrs)
  • string $name
  • array $attrs
  • $value
addChild (line 512)

Adds a direct child to the element

void addChild (string $name, array $attrs, int $level)
  • string $name
  • array $attrs
  • int $level
asXML (line 603)

Return a well-formed XML string based on SimpleXML element

string asXML ([ $whitespace = true])
  • $whitespace
attributes (line 433)

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
  • access: public
mixed attributes ([string $attribute = null])
  • string $attribute: The name of the attribute
children (line 469)

Get the children of the element

  • access: public
array children ()
data (line 448)

Get the data of the element

  • access: public
string data ()
getElementByPath (line 555)

Get an element in the document by / separated path

object JSimpleXMLElement &getElementByPath (string $path)
  • string $path: The / separated path to the element
level (line 479)

Get the level of the element

  • access: public
int level ()
map (line 586)
void map ( $callback, [ $args = array()])
  • $callback
  • $args
name (line 420)

Get the name of the element

  • access: public
string name ()
removeAttribute (line 500)

Removes an attribute from the element

void removeAttribute (string $name)
  • string $name
removeChild (line 529)
void removeChild ( &$child)
  • &$child
setData (line 459)

Set the data of the element

  • access: public
string setData (string $data)
  • string $data

Inherited Methods

Inherited From JObject

 JObject::JObject()
 JObject::__construct()
 JObject::get()
 JObject::getPublicProperties()
 JObject::set()
 JObject::toString()

Documentation generated on Mon, 05 Mar 2007 21:25:21 +0000 by phpDocumentor 1.3.1