-
Notifications
You must be signed in to change notification settings - Fork 20
XmlSerializable
Thomas Weinert edited this page Jul 29, 2014
·
1 revision
Defines an object that can return its output as an XML fragment. The interface extends FluentDOM\Appendable
. An class implementing this needs to implement appendTo()
but you can use the trait XmlSerialize
to implement getXml()
.
class Example implements \FluentDOM\XmlSerializable {
use \FluentDOM\XmlSerialize;
public function appendTo(\FluentDOM\Element $parent) {
$parent->appendElement(
'message',
'Hello World!'
);
}
}
$example = new Example();
echo $example->getXml();
```
### Output
```xml
<message>Hello World!</message>
```
- 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