PHP Класс Prado\Xml\TXmlElement

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
С версии: 3.0
Автор: Qiang Xue ([email protected])
Наследование: extends Prado\TComponent
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( $tagName ) Constructor.
__toString ( ) : string Magic-method override. Called whenever this element is used as a string.
getAttribute ( $name ) : string
getAttributes ( ) : TMap
getElementByTagName ( $tagName ) : TXmlElement
getElements ( ) : TXmlElementList
getElementsByTagName ( $tagName ) : Prado\Collections\TList
getHasAttribute ( ) : boolean
getHasElement ( ) : boolean
getParent ( ) : TXmlElement
getTagName ( ) : string
getValue ( ) : string
setAttribute ( $name, $value )
setParent ( $parent )
setTagName ( $tagName )
setValue ( $value )
toString ( $indent ) : string

Приватные методы

Метод Описание
xmlEncode ( $str )

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( $tagName )

__toString() публичный Метод

$element = new TXmlElement('tag'); echo $element; or $element = new TXmlElement('tag'); $xml = (string)$element;
public __toString ( ) : string
Результат string string representation of this element

getAttribute() публичный Метод

public getAttribute ( $name ) : string
Результат string the attribute specified by the name, null if no such attribute

getAttributes() публичный Метод

public getAttributes ( ) : TMap
Результат Prado\Collections\TMap list of attributes

getElementByTagName() публичный Метод

public getElementByTagName ( $tagName ) : TXmlElement
Результат TXmlElement the first child element that has the specified tag-name, null if not found

getElements() публичный Метод

public getElements ( ) : TXmlElementList
Результат TXmlElementList list of child elements

getElementsByTagName() публичный Метод

public getElementsByTagName ( $tagName ) : Prado\Collections\TList
Результат Prado\Collections\TList list of all child elements that have the specified tag-name

getHasAttribute() публичный Метод

public getHasAttribute ( ) : boolean
Результат boolean true if this element has attributes

getHasElement() публичный Метод

public getHasElement ( ) : boolean
Результат boolean true if this element has child elements

getParent() публичный Метод

public getParent ( ) : TXmlElement
Результат TXmlElement parent element of this element

getTagName() публичный Метод

public getTagName ( ) : string
Результат string tag-name of this element

getValue() публичный Метод

public getValue ( ) : string
Результат string text enclosed between opening and closing tag of this element

setAttribute() публичный Метод

public setAttribute ( $name, $value )

setParent() публичный Метод

public setParent ( $parent )

setTagName() публичный Метод

public setTagName ( $tagName )

setValue() публичный Метод

public setValue ( $value )

toString() публичный Метод

public toString ( $indent ) : string
Результат string string representation of this element