extends |
XMLWriter |
---|---|
uses |
ContextStackTrait |
The XML Writer class.
This class works exactly as PHP's built-in XMLWriter, with a few additions.
Namespaces can be registered beforehand, globally. When the first element is written, namespaces will automatically be declared.
The writeAttribute, startElement and writeElement can now take a clark-notation element name (example: {http://www.w3.org/2005/Atom}link).
If, when writing the namespace is a known one a prefix will automatically be selected, otherwise a random prefix will be generated.
Instead of standard string values, the writer can take Element classes (as defined by this library) to delegate the serialization.
The write() method can take array structures to quickly write out simple xml trees.
Methods | ||
---|---|---|
public
|
write(mixed $value)
|
# |
public
|
startElement(string $name): bool
|
# |
public
|
writeElement($name, array|string|object|null $content = null): bool
|
# |
public
|
writeAttributes(array $attributes)
|
# |
public
|
writeAttribute(string $name, string $value): bool
|
# |
Methods used from Sabre\Xml\ContextStackTrait |
---|
pushContext(), popContext() |
Properties used from Sabre\Xml\ContextStackTrait |
---|
$elementMap, $contextUri, $namespaceMap, $classMap |