PHP Класс FluentDOM\Element

Наследование: extends DOMElement, implements ArrayAccess, implements Countable, implements IteratorAggregate, implements FluentDOM\Node\ChildNode, implements Node\NonDocumentTypeChildNode, implements FluentDOM\Node\ParentNode, use trait FluentDOM\Node\ChildNode\Implementation, use trait FluentDOM\Node\NonDocumentTypeChildNode\Implementation, use trait FluentDOM\Node\ParentNode\Implementation, use trait Node\QuerySelector\Implementation, use trait FluentDOM\Node\StringCast, use trait FluentDOM\Node\Xpath, use trait FluentDOM\HHVM\Properties
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__get ( $name )
__set ( $name, $value )
append ( mixed $value ) Append a value to the element node
appendElement ( string $name, string $content = '', array $attributes = NULL ) : Element Append an child element
appendToParentNode ( )
appendXml ( string $xmlFragment ) Append an xml fragment to the element node
applyNamespaces ( null | string | array $prefixes = NULL ) Sets all namespaces registered on the document as xmlns attributes on the element.
count ( ) : integer Return child node count
find ( string $expression ) : Query Put the current node into a FluentDOM\Query and call find() on it.
getAttribute ( string $name ) : string Get an attribute value
getAttributeNode ( string $name ) : Attribute | DOMAttr Get an attribute value
getElementsByTagName ( string $name ) : DOMNodeList Allow getElementsByTagName to use the defined namespaces.
getIterator ( ) : ElementIterator Return Iterator for child nodes.
hasAttribute ( string $name ) : boolean Validate if an attribute exists
offsetExists ( integer | string $offset ) : boolean Validate if an offset exists. If a integer is provided it will check for a child node, if a string is provided for an attribute.
offsetGet ( integer | string $offset ) : DOMNode | mixed | string Get a child node by its numeric index, or an attribute by its name.
offsetSet ( integer | string $offset, DOMNode | string $value ) : DOMAttr | DOMNode | void
offsetUnset ( integer | string $offset ) Remove a child node using its index or an attribute node using its name.
removeAttribute ( string $name ) : boolean Set an attribute on an element
saveHtml ( ) : string save the element node as HTML
saveXml ( ) : string save the element node as XML
saveXmlFragment ( ) : string Save the child nodes of this element as an XML fragment.
setAttribute ( string $name, string $value ) : DOMAttr Set an attribute on an element
setIdAttribute ( string $name, boolean $isId ) Set an attribute on an element

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

Метод Описание
getDocument ( ) : Document A getter for the owner document
isAttributeOffset ( mixed $offset ) : boolean Attribute offsets are strings that can not only contains digits.
isCurrentNamespace ( string $prefix, string $namespace ) : boolean Return true if the provided namespace is the same as the one on the element
isNodeOffset ( mixed $offset ) : boolean Node offsets are integers, or strings containing only digits.
resolveTagName ( string $name ) : string[] Resolves a provided tag name into namespace and local name

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

__get() публичный метод

public __get ( $name )

__set() публичный метод

public __set ( $name, $value )

append() публичный метод

The value can be: - a node (automatically imported and cloned) - an object implementing FluentDOM\Appendable (method appendTo()) - a scalar or object castable to string (adds a text node) - an array (sets attributes)
public append ( mixed $value )
$value mixed

appendElement() публичный метод

Append an child element
public appendElement ( string $name, string $content = '', array $attributes = NULL ) : Element
$name string
$content string
$attributes array
Результат Element

appendToParentNode() публичный метод

public appendToParentNode ( )

appendXml() публичный метод

Append an xml fragment to the element node
public appendXml ( string $xmlFragment )
$xmlFragment string

applyNamespaces() публичный метод

Sets all namespaces registered on the document as xmlns attributes on the element.
public applyNamespaces ( null | string | array $prefixes = NULL )
$prefixes null | string | array

count() публичный метод

Return child node count
public count ( ) : integer
Результат integer

find() публичный метод

Put the current node into a FluentDOM\Query and call find() on it.
public find ( string $expression ) : Query
$expression string
Результат Query

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

Get an attribute value
public getAttribute ( string $name ) : string
$name string
Результат string

getAttributeNode() публичный метод

Get an attribute value
public getAttributeNode ( string $name ) : Attribute | DOMAttr
$name string
Результат Attribute | DOMAttr

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

Allow getElementsByTagName to use the defined namespaces.
public getElementsByTagName ( string $name ) : DOMNodeList
$name string
Результат DOMNodeList

getIterator() публичный метод

Return Iterator for child nodes.
public getIterator ( ) : ElementIterator
Результат FluentDOM\Iterators\ElementIterator

hasAttribute() публичный метод

Validate if an attribute exists
public hasAttribute ( string $name ) : boolean
$name string
Результат boolean

offsetExists() публичный метод

Validate if an offset exists. If a integer is provided it will check for a child node, if a string is provided for an attribute.
public offsetExists ( integer | string $offset ) : boolean
$offset integer | string
Результат boolean

offsetGet() публичный метод

Get a child node by its numeric index, or an attribute by its name.
public offsetGet ( integer | string $offset ) : DOMNode | mixed | string
$offset integer | string
Результат DOMNode | mixed | string

offsetSet() публичный метод

public offsetSet ( integer | string $offset, DOMNode | string $value ) : DOMAttr | DOMNode | void
$offset integer | string
$value DOMNode | string
Результат DOMAttr | DOMNode | void

offsetUnset() публичный метод

Remove a child node using its index or an attribute node using its name.
public offsetUnset ( integer | string $offset )
$offset integer | string

removeAttribute() публичный метод

Set an attribute on an element
public removeAttribute ( string $name ) : boolean
$name string
Результат boolean

saveHtml() публичный метод

save the element node as HTML
public saveHtml ( ) : string
Результат string

saveXml() публичный метод

save the element node as XML
public saveXml ( ) : string
Результат string

saveXmlFragment() публичный метод

Save the child nodes of this element as an XML fragment.
public saveXmlFragment ( ) : string
Результат string

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

Set an attribute on an element
public setAttribute ( string $name, string $value ) : DOMAttr
$name string
$value string
Результат DOMAttr

setIdAttribute() публичный метод

Set an attribute on an element
public setIdAttribute ( string $name, boolean $isId )
$name string
$isId boolean