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
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
|
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
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
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.
or - $element = new TXmlElement('tag');
- $xml = (string)$element;
Output |
string
| string representation of this element |
Exception |
|