PHP Class 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
Since: 3.0
Author: Qiang Xue ([email protected])
Inheritance: extends Prado\TComponent
Afficher le fichier Open project: pradosoft/prado Class Usage Examples

Méthodes publiques

Méthode Description
__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

Private Methods

Méthode Description
xmlEncode ( $str )

Method Details

__construct() public méthode

Constructor.
public __construct ( $tagName )

__toString() public méthode

$element = new TXmlElement('tag'); echo $element; or $element = new TXmlElement('tag'); $xml = (string)$element;
public __toString ( ) : string
Résultat string string representation of this element

getAttribute() public méthode

public getAttribute ( $name ) : string
Résultat string the attribute specified by the name, null if no such attribute

getAttributes() public méthode

public getAttributes ( ) : TMap
Résultat Prado\Collections\TMap list of attributes

getElementByTagName() public méthode

public getElementByTagName ( $tagName ) : TXmlElement
Résultat TXmlElement the first child element that has the specified tag-name, null if not found

getElements() public méthode

public getElements ( ) : TXmlElementList
Résultat TXmlElementList list of child elements

getElementsByTagName() public méthode

public getElementsByTagName ( $tagName ) : Prado\Collections\TList
Résultat Prado\Collections\TList list of all child elements that have the specified tag-name

getHasAttribute() public méthode

public getHasAttribute ( ) : boolean
Résultat boolean true if this element has attributes

getHasElement() public méthode

public getHasElement ( ) : boolean
Résultat boolean true if this element has child elements

getParent() public méthode

public getParent ( ) : TXmlElement
Résultat TXmlElement parent element of this element

getTagName() public méthode

public getTagName ( ) : string
Résultat string tag-name of this element

getValue() public méthode

public getValue ( ) : string
Résultat string text enclosed between opening and closing tag of this element

setAttribute() public méthode

public setAttribute ( $name, $value )

setParent() public méthode

public setParent ( $parent )

setTagName() public méthode

public setTagName ( $tagName )

setValue() public méthode

public setValue ( $value )

toString() public méthode

public toString ( $indent ) : string
Résultat string string representation of this element