- Home
- About
- Testimonials
- Demos
- Download
- Documentation
- Blogs
- Forum
- Support

Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml
Classes:
TXmlDocument
TXmlElement
TXmlElementList

Keyword

# Class TXmlElement

    TComponent
       |
       --TXmlElement

#### Direct Known Sub-classes:

TXmlDocument

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
Author: Qiang Xue <qiang.xue@gmail.com>

Constructor Summary
public | __construct Array Constructor.

Method Summary
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 () Magic-method override. Called whenever this element is used as a string.

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()

Constructor Details

## __construct

public __construct | Array

Constructor.

Method Details

## getAttribute

public string getAttribute | (mixed $name )

Input
mixed | $name |
Output
string | the attribute specified by the name, null if no such attribute
Exception

## getAttributes

public TMap getAttributes | ()

Output
TMap | list of attributes
Exception

## getElementByTagName

public TXmlElement getElementByTagName | (mixed $tagName )

Input
mixed | $tagName |
Output
TXmlElement | the first child element that has the specified tag-name, null if not found
Exception

## getElements

public TXmlElementList getElements | ()

Output
TXmlElementList | list of child elements
Exception

## getElementsByTagName

public TList getElementsByTagName | (mixed $tagName )

Input
mixed | $tagName |
Output
TList | list of all child elements that have the specified tag-name
Exception

## getHasAttribute

public boolean getHasAttribute | ()

Output
boolean | true if this element has attributes
Exception

## getHasElement

public boolean getHasElement | ()

Output
boolean | true if this element has child elements
Exception

## getParent

public TXmlElement getParent | ()

Output
TXmlElement | parent element of this element
Exception

## getTagName

public string getTagName | ()

Output
string | tag-name of this element
Exception

## getValue

public string getValue | ()

Output
string | text enclosed between opening and closing tag of this element
Exception

## setAttribute

public void setAttribute | (string $name , string $value )

Input
string | $name | attribute name
string | $value | attribute value
Output
Exception

## setParent

public void setParent | (TXmlElement $parent )

Input
TXmlElement | $parent | parent element of this element
Output
Exception

## setTagName

public void setTagName | (string $tagName )

Input
string | $tagName | tag-name of this element
Output
Exception

## setValue

public void setValue | (string $value )

Input
string | $value | text enclosed between opening and closing tag of this element
Output
Exception

## toString

public string toString | (mixed $indent )

Input
mixed | $indent |
Output
string | string representation of this element
Exception

## __toString

public string __toString | ()

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;

Output
string | string representation of this element
Exception