ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Public Member Functions | |
write ($value) | |
Writes a value to the output stream. More... | |
startElement ($name) | |
Opens a new element. More... | |
writeElement ($name, $content=null) | |
Write a full element tag and it's contents. More... | |
writeAttributes (array $attributes) | |
Writes a list of attributes. More... | |
writeAttribute ($name, $value) | |
Writes a new attribute. More... | |
Protected Attributes | |
$adhocNamespaces = [] | |
$namespacesWritten = false | |
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.
Definition at line 31 of file Writer.php.
Sabre\Xml\Writer::startElement | ( | $name | ) |
Opens a new element.
You can either just use a local elementname, or you can use clark- notation to start a new element.
Example:
$writer->startElement('{http://www.w3.org/2005/Atom}entry');
Would result in something like:
<entry xmlns="http://w3.org/2005/Atom">
string | $name |
Definition at line 121 of file Writer.php.
References $name, $namespace, $result, Sabre\Xml\Service\parseClarkNotation(), and Sabre\Xml\Writer\writeAttribute().
Referenced by Sabre\DAVACL\Xml\Property\Acl\serializeAce(), Sabre\DAVACL\Xml\Property\SupportedPrivilegeSet\serializePriv(), Sabre\Xml\Serializer\standardSerializer(), Sabre\Xml\Writer\writeElement(), Sabre\CalDAV\Xml\Property\SupportedCalendarData\xmlSerialize(), Sabre\DAV\Xml\Request\PropPatch\xmlSerialize(), Sabre\Xml\Element\XmlFragment\xmlSerialize(), Sabre\DAVACL\Xml\Property\CurrentUserPrivilegeSet\xmlSerialize(), Sabre\DAV\Xml\Property\LockDiscovery\xmlSerialize(), Sabre\CalDAV\Xml\Property\Invite\xmlSerialize(), Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet\xmlSerialize(), Sabre\DAV\Xml\Property\SupportedMethodSet\xmlSerialize(), Sabre\CalDAV\Xml\Notification\SystemStatus\xmlSerialize(), Sabre\DAV\Xml\Property\SupportedReportSet\xmlSerialize(), Sabre\DAV\Xml\Element\Response\xmlSerialize(), Sabre\CalDAV\Xml\Notification\SystemStatus\xmlSerializeFull(), Sabre\CalDAV\Xml\Notification\InviteReply\xmlSerializeFull(), and Sabre\CalDAV\Xml\Notification\Invite\xmlSerializeFull().
Sabre\Xml\Writer::write | ( | $value | ) |
Writes a value to the output stream.
The following values are supported:
Array format 1: [ "{namespace}name1" => "..", "{namespace}name2" => "..", ]
One element will be created for each key in this array. The values of this array support any format this method supports (this method is called recursively).
Array format 2:
[ [ "name" => "{namespace}name1" "value" => "..", "attributes" => [ "attr" => "attribute value", ] ], [ "name" => "{namespace}name1" "value" => "..", "attributes" => [ "attr" => "attribute value", ] ] ]
mixed | $value |
Definition at line 98 of file Writer.php.
References Sabre\Xml\Serializer\standardSerializer().
Referenced by Sabre\Xml\Serializer\standardSerializer(), Sabre\Xml\Writer\writeElement(), Sabre\DAV\Xml\Request\PropPatch\xmlSerialize(), Sabre\DAV\Xml\Property\GetLastModified\xmlSerialize(), and Sabre\DAV\Xml\Element\Sharee\xmlSerialize().
Sabre\Xml\Writer::writeAttribute | ( | $name, | |
$value | |||
) |
Writes a new attribute.
The name may be specified in clark-notation.
Returns true when successful.
string | $name | |
string | $value |
Definition at line 230 of file Writer.php.
References $name, $namespace, and Sabre\Xml\Service\parseClarkNotation().
Referenced by Sabre\Xml\Writer\startElement(), Sabre\Xml\Writer\writeAttributes(), Sabre\Xml\Element\XmlFragment\xmlSerialize(), Sabre\DAV\Xml\Property\SupportedMethodSet\xmlSerialize(), Sabre\CalDAV\Xml\Notification\SystemStatus\xmlSerialize(), and Sabre\CalDAV\Xml\Notification\SystemStatus\xmlSerializeFull().
Sabre\Xml\Writer::writeAttributes | ( | array | $attributes | ) |
Writes a list of attributes.
Attributes are specified as a key->value array.
The key is an attribute name. If the key is a 'localName', the current xml namespace is assumed. If it's a 'clark notation key', this namespace will be used instead.
array | $attributes |
Definition at line 211 of file Writer.php.
References $name, and Sabre\Xml\Writer\writeAttribute().
Referenced by Sabre\Xml\Serializer\standardSerializer(), Sabre\CalDAV\Xml\Property\SupportedCalendarData\xmlSerialize(), and Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet\xmlSerialize().
Sabre\Xml\Writer::writeElement | ( | $name, | |
$content = null |
|||
) |
Write a full element tag and it's contents.
This method automatically closes the element as well.
The element name may be specified in clark-notation.
Examples:
$writer->writeElement('{http://www.w3.org/2005/Atom}author',null); becomes: <author xmlns="http://www.w3.org/2005">
$writer->writeElement('{http://www.w3.org/2005/Atom}author', [ '{http://www.w3.org/2005/Atom}name' => 'Evert Pot', ]); becomes: <author xmlns="http://www.w3.org/2005"><name>Evert Pot</name></author>
string | $name | |
string | $content |
Definition at line 189 of file Writer.php.
References $name, Sabre\Xml\Writer\startElement(), and Sabre\Xml\Writer\write().
Referenced by Sabre\Xml\Serializer\enum(), Sabre\Xml\Serializer\repeatingElements(), Sabre\DAVACL\Xml\Property\Acl\serializeAce(), Sabre\DAVACL\Xml\Property\SupportedPrivilegeSet\serializePriv(), Sabre\Xml\WriterTest\testClassMap(), Sabre\Xml\Serializer\valueObject(), Sabre\DAVACL\Xml\Property\AclRestrictions\xmlSerialize(), Sabre\CardDAV\Xml\Property\SupportedCollationSet\xmlSerialize(), Sabre\DAV\Xml\Property\SupportedLock\xmlSerialize(), Sabre\CalDAV\Xml\Property\SupportedCollationSet\xmlSerialize(), Sabre\DAV\Xml\Property\Invite\xmlSerialize(), Sabre\DAVACL\Xml\Property\CurrentUserPrivilegeSet\xmlSerialize(), Sabre\DAV\Xml\Property\LockDiscovery\xmlSerialize(), Sabre\CalDAV\Xml\Property\EmailAddressSet\xmlSerialize(), Sabre\CalDAV\Xml\Property\Invite\xmlSerialize(), Sabre\CalDAV\Xml\Property\AllowedSharingModes\xmlSerialize(), Sabre\DAV\Xml\Property\ShareAccess\xmlSerialize(), Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp\xmlSerialize(), Sabre\DAV\Xml\Response\MultiStatus\xmlSerialize(), Sabre\DAV\Xml\Property\Href\xmlSerialize(), Sabre\DAVACL\Xml\Property\Principal\xmlSerialize(), Sabre\DAV\Xml\Property\SupportedReportSet\xmlSerialize(), Sabre\DAV\Xml\Element\Response\xmlSerialize(), Sabre\DAV\Xml\Element\Sharee\xmlSerialize(), Sabre\CalDAV\Xml\Notification\InviteReply\xmlSerialize(), Sabre\CalDAV\Xml\Notification\Invite\xmlSerialize(), Sabre\CalDAV\Xml\Notification\SystemStatus\xmlSerializeFull(), Sabre\CalDAV\Xml\Notification\InviteReply\xmlSerializeFull(), and Sabre\CalDAV\Xml\Notification\Invite\xmlSerializeFull().
|
protected |
Definition at line 44 of file Writer.php.
|
protected |
Definition at line 54 of file Writer.php.