-
Notifications
You must be signed in to change notification settings - Fork 20
Appendable
Thomas Weinert edited this page Jul 12, 2018
·
3 revisions
An interface that can be used to define a class as appendable to an Element node.
class Example implements \FluentDOM\Appendable {
public function appendTo(\FluentDOM\Element $parent) {
$parent->appendChild(
$parent->ownerDocument->createTextNode('Hello World!')
);
}
}
$document = new FluentDOM\DOM\Document();
$document->appendChild($document->createElement('xml'));
$document->documentElement->append(new Example());
echo $document->saveXml();
```
### Output
```xml
<?xml version="1.0" encoding="UTF-8"?>
<xml>Hello World!</xml>
```
See also:
[[FluentDOM\Element::append()|Element-Append]]
- Home
- Getting Started
- Tasks
- Plugins
- Functions
- Lists
- Creator (5.1)
- CSS Selectors
- Convertors
- Loaders
- Serializers (5.1)
- Transformers (5.1)
- Extended DOM
- XMLReader (6.1)
- XMLWriter (6.1)
- Interfaces