Class Sabre\Xml\Writer

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
Methods inherited from XMLWriter
openUri(), openMemory(), setIndent(), setIndentString(), startComment(), endComment(), startAttribute(), endAttribute(), startAttributeNs(), writeAttributeNs(), endElement(), fullEndElement(), startElementNs(), writeElementNs(), startPi(), endPi(), writePi(), startCdata(), endCdata(), writeCdata(), text(), writeRaw(), startDocument(), endDocument(), writeComment(), startDtd(), endDtd(), writeDtd(), startDtdElement(), endDtdElement(), writeDtdElement(), startDtdAttlist(), endDtdAttlist(), writeDtdAttlist(), startDtdEntity(), endDtdEntity(), writeDtdEntity(), outputMemory(), flush()
Methods used from Sabre\Xml\ContextStackTrait
pushContext(), popContext()
Properties used from Sabre\Xml\ContextStackTrait
$elementMap, $contextUri, $namespaceMap, $classMap