PHP Class FluentDOM\DocumentFragment

Be aware that a fragment is empty after it was appended.
Inheritance: extends DOMDocumentFragment, implements Countable, implements IteratorAggregate, implements FluentDOM\Node\ParentNode, use trait FluentDOM\Node\ParentNode\Properties, use trait Node\QuerySelector\Implementation, use trait FluentDOM\Node\Xpath
ファイルを表示 Open project: fluentdom/fluentdom

Public Methods

Method Description
__toString ( ) : string Casting the fragment to string will return the text content of all nodes
appendElement ( string $name, string $content = '', array $attributes = NULL ) : Element Append an child element
appendXml ( string $data, null | array | Traversable | DOMElement $namespaces = NULL ) : boolean Append an xml to the fragment, it can use namespace prefixes defined on the fragment object.
count ( ) : integer
getIterator ( ) : Iterator
namespaces ( null | array | Traversable | DOMElement $namespaces = NULL ) : array Get/Set the namespace definition used for the fragment strings.
registerNamespace ( $prefix, $namespace ) Register a namespace prefix to use it in appendXml()
saveXmlFragment ( ) : string Save as XML string

Method Details

__toString() public method

Casting the fragment to string will return the text content of all nodes
public __toString ( ) : string
return string

appendElement() public method

Append an child element
public appendElement ( string $name, string $content = '', array $attributes = NULL ) : Element
$name string
$content string
$attributes array
return Element

appendXml() public method

Append an xml to the fragment, it can use namespace prefixes defined on the fragment object.
public appendXml ( string $data, null | array | Traversable | DOMElement $namespaces = NULL ) : boolean
$data string
$namespaces null | array | Traversable | DOMElement
return boolean

count() public method

public count ( ) : integer
return integer

getIterator() public method

public getIterator ( ) : Iterator
return Iterator

namespaces() public method

You can use an array(prefix => $namespace, ...) or an element node to set the namespaces. If the list is empty the document, the namespaces from the document object will be used.
public namespaces ( null | array | Traversable | DOMElement $namespaces = NULL ) : array
$namespaces null | array | Traversable | DOMElement
return array

registerNamespace() public method

Register a namespace prefix to use it in appendXml()
public registerNamespace ( $prefix, $namespace )
$prefix
$namespace

saveXmlFragment() public method

Save as XML string
public saveXmlFragment ( ) : string
return string