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