## Class TXmlElement

Description

TXmlElement class.

TXmlElement represents an XML element node. You can obtain its tag-name, attributes, text between the opening and closing tags via the TagName, Attributes, and Value properties, respectively. You can also retrieve its parent and child elements by Parent and Elements properties, respectively.

TBD: xpath

- since: 3.0
- version: $Id: TXmlDocument.php 2370 2008-01-23 01:49:02Z xue $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Xml/TXmlDocument.php (line 29)

    TComponent
       |
       --TXmlElement

Direct descendents

Class | Description
--- | ---
TXmlDocument | TXmlDocument class.

Method Summary
TXmlElement __construct (string $tagName)
string getAttribute (mixed $name)
TMap getAttributes ()
TXmlElement getElementByTagName (mixed $tagName)
TXmlElementList getElements ()
TList getElementsByTagName (mixed $tagName)
boolean getHasAttribute ()
boolean getHasElement ()
TXmlElement getParent ()
string getTagName ()
string getValue ()
void setAttribute (string $name, string $value)
void setParent (TXmlElement $parent)
void setTagName (string $tagName)
void setValue (string $value)
string toString (mixed $indent)
string __toString ()
Methods
Constructor __construct (line 56)

Constructor.

- access: public

TXmlElement __construct (string $tagName)

- string $tagName: tag-name for this element

Redefined in descendants as:

- TXmlDocument::__construct() : Constructor.

getAttribute (line 128)

- return: the attribute specified by the name, null if no such attribute
- access: public

string getAttribute (mixed $name)
getAttributes (line 158)

- return: list of attributes
- access: public

TMap getAttributes ()
getElementByTagName (line 168)

- return: the first child element that has the specified tag-name, null if not found
- access: public

TXmlElement getElementByTagName (mixed $tagName)
getElements (line 148)

- return: list of child elements
- access: public

TXmlElementList getElements ()
getElementsByTagName (line 182)

- return: list of all child elements that have the specified tag-name
- access: public

TList getElementsByTagName (mixed $tagName)
getHasAttribute (line 120)

- return: true if this element has attributes
- access: public

boolean getHasAttribute ()
getHasElement (line 112)

- return: true if this element has child elements
- access: public

boolean getHasElement ()
getParent (line 64)

- return: parent element of this element
- access: public

TXmlElement getParent ()
getTagName (line 80)

- return: tag-name of this element
- access: public

string getTagName ()
getValue (line 96)

- return: text enclosed between opening and closing tag of this element
- access: public

string getValue ()
setAttribute (line 140)

- access: public

void setAttribute (string $name, string $value)

- string $name: attribute name
- string $value: attribute value

setParent (line 72)

- access: public

void setParent (TXmlElement $parent)

- TXmlElement $parent: parent element of this element

setTagName (line 88)

- access: public

void setTagName (string $tagName)

- string $tagName: tag-name of this element

setValue (line 104)

- access: public

void setValue (string $value)

- string $value: text enclosed between opening and closing tag of this element

toString (line 197)

- return: string representation of this element
- access: public

string toString (mixed $indent)
__toString (line 239)

Magic-method override. Called whenever this element is used as a string.

     $element = new TXmlElement('tag');
     echo $element;

or

     $element = new TXmlElement('tag');
     $xml = (string)$element;

- return: string representation of this element
- access: public

string __toString ()

Redefined in descendants as:

- TXmlDocument::__toString() : Magic-method override. Called whenever this document is used as a string.

#### Inherited Methods

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Documentation generated on Mon, 21 Apr 2008 11:36:53 -0400 by phpDocumentor 1.3.0RC4