Exemple #1
0
 /**
  * This method serializes only the value of a property. This is used to
  * create xCard or xCal documents.
  *
  * @param Xml\Writer $writer  XML writer.
  *
  * @return void
  */
 protected function xmlSerializeValue(Xml\Writer $writer)
 {
     // xCard is the only XML and JSON format that has the same date and time
     // format than vCard.
     $valueType = strtolower($this->getValueType());
     $writer->writeElement($valueType, $this->getValue());
 }
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     $collations = ['i;ascii-casemap', 'i;octet', 'i;unicode-casemap'];
     foreach ($collations as $collation) {
         $writer->writeElement('{' . Plugin::NS_CALDAV . '}supported-collation', $collation);
     }
 }
 /**
  * Prepare XML file based on AnalysisResult.
  * @param AnalysisResult $result analysis result object.
  * @return string XML contents.
  */
 protected function getXmlFor(AnalysisResult $result)
 {
     $writer = new Writer();
     $writer->openMemory();
     $writer->write($this->getSabreXmlArrayFor($result));
     return '<?xml version="1.0" encoding="UTF-8"?>' . $writer->outputMemory();
 }
Exemple #4
0
 /**
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     // This is required
     $writer->write(['loc' => $this->location]);
     // This is optional
     $this->add($writer, ['lastmod']);
 }
 /**
  * @param XmlSerializable $data
  * @return string
  */
 protected function buildMessage(XmlSerializable $data)
 {
     $this->writer->openMemory();
     $msgData = $this->buildMsgData($data);
     $this->writer->write([$this->rootEl => ['attributes' => $this->rootElAttributes, 'value' => $msgData]]);
     return $this->writer->outputMemory(true);
 }
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     $productData = [$this->category => []];
     if ($this->productType) {
         $productData[$this->category] = ['ProductType' => [$this->productType => ['AdditionalDrives' => 'dvd', 'ComputerMemoryType' => 'sodimm', 'DisplayResolutionMaximum' => 'fullhd   ']]];
     }
     $writer->write(['MessageID' => 1, 'OperationType' => 'Update', 'Product' => ['SKU' => $this->sku, 'DescriptionData' => ['Title' => $this->title, 'Brand' => $this->brand, 'Description' => $this->description, 'MSRP' => ['attributes' => ['currency' => $this->currency], 'value' => $this->msrp]], 'ProductData' => $productData]]);
 }
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     foreach ($this->getValue() as $val) {
         $writer->startElement('{DAV:}supported-method');
         $writer->writeAttribute('name', $val);
         $writer->endElement();
     }
 }
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     foreach ($this->components as $component) {
         $writer->startElement('{' . Plugin::NS_CALDAV . '}comp');
         $writer->writeAttributes(['name' => $component]);
         $writer->endElement();
     }
 }
Exemple #9
0
 /**
  * Adds property from properties to url if it is not null.
  *
  * @param Writer $writer
  * @param array $properties
  */
 private function add(Writer $writer, array $properties)
 {
     foreach ($properties as $property) {
         if (!is_null($this->{$property})) {
             $writer->write([$property => $this->{$property}]);
         }
     }
 }
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     foreach ($this->privileges as $privName) {
         $writer->startElement('{DAV:}privilege');
         $writer->writeElement($privName);
         $writer->endElement();
     }
 }
Exemple #11
0
 /**
  * The serialize method is called during xml writing.
  *
  * It should use the $writer argument to encode this object into XML.
  *
  * Important note: it is not needed to create the parent element. The
  * parent element is already created, and we only have to worry about
  * attributes, child elements and text (if any).
  *
  * Important note 2: If you are writing any new elements, you are also
  * responsible for closing them.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     foreach ($this->getResponses() as $response) {
         $writer->writeElement('{DAV:}response', $response);
     }
     if ($syncToken = $this->getSyncToken()) {
         $writer->writeElement('{DAV:}sync-token', $syncToken);
     }
 }
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     foreach ($this->supportedData as $supported) {
         $writer->startElement('{' . Plugin::NS_CARDDAV . '}address-data-type');
         $writer->writeAttributes(['content-type' => $supported['contentType'], 'version' => $supported['version']]);
         $writer->endElement();
         // address-data-type
     }
 }
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     if ($this->canBeShared) {
         $writer->writeElement('{' . Plugin::NS_CALENDARSERVER . '}can-be-shared');
     }
     if ($this->canBePublished) {
         $writer->writeElement('{' . Plugin::NS_CALENDARSERVER . '}can-be-published');
     }
 }
Exemple #14
0
 function write($input)
 {
     $writer = new Writer();
     $writer->contextUri = $this->contextUri;
     $writer->namespaceMap = $this->namespaceMap;
     $writer->openMemory();
     $writer->setIndent(true);
     $writer->write($input);
     return $writer->outputMemory();
 }
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     switch ($this->value) {
         case self::TRANSPARENT:
             $writer->writeElement('{' . Plugin::NS_CALDAV . '}transparent');
             break;
         case self::OPAQUE:
             $writer->writeElement('{' . Plugin::NS_CALDAV . '}opaque');
             break;
     }
 }
Exemple #16
0
    /**
     * The xmlSerialize metod is called during xml writing.
     *
     * Use the $writer argument to write its own xml serialization.
     *
     * An important note: do _not_ create a parent element. Any element
     * implementing XmlSerializble should only ever write what's considered
     * its 'inner xml'.
     *
     * The parent of the current element is responsible for writing a
     * containing element.
     *
     * This allows serializers to be re-used for different element names.
     *
     * If you are opening new elements, you must also close them again.
     *
     * @param Writer $writer
     * @return void
     */
    function xmlSerialize(Writer $writer) {

        foreach ($this->properties as $propertyName => $propertyValue) {

            if (is_null($propertyValue)) {
                $writer->write(['{DAV:}remove' => [$propertyName => $propertyValue]]);
            } else {
                $writer->write(['{DAV:}set' => [$propertyName => $propertyValue]]);
            }

        }

    }
Exemple #17
0
    /**
     * The xmlSerialize metod is called during xml writing.
     *
     * Use the $writer argument to write its own xml serialization.
     *
     * An important note: do _not_ create a parent element. Any element
     * implementing XmlSerializble should only ever write what's considered
     * its 'inner xml'.
     *
     * The parent of the current element is responsible for writing a
     * containing element.
     *
     * This allows serializers to be re-used for different element names.
     *
     * If you are opening new elements, you must also close them again.
     *
     * @param Writer $writer
     * @return void
     */
    function xmlSerialize(Writer $writer)
    {
        $reader = new Reader();
        // Wrapping the xml in a container, so root-less values can still be
        // parsed.
        $xml = <<<XML
<?xml version="1.0"?>
<xml-fragment xmlns="http://sabre.io/ns">{$this->getXml()}</xml-fragment>
XML;
        $reader->xml($xml);
        $elementNamespace = null;
        while ($reader->read()) {
            if ($reader->depth < 1) {
                // Skipping the root node.
                continue;
            }
            switch ($reader->nodeType) {
                case Reader::ELEMENT:
                    $writer->startElement($reader->getClark());
                    $empty = $reader->isEmptyElement;
                    while ($reader->moveToNextAttribute()) {
                        switch ($reader->namespaceURI) {
                            case '':
                                $writer->writeAttribute($reader->localName, $reader->value);
                                break;
                            case 'http://www.w3.org/2000/xmlns/':
                                // Skip namespace declarations
                                break;
                            default:
                                $writer->writeAttribute($reader->getClark(), $reader->value);
                                break;
                        }
                    }
                    if ($empty) {
                        $writer->endElement();
                    }
                    break;
                case Reader::CDATA:
                case Reader::TEXT:
                    $writer->text($reader->value);
                    break;
                case Reader::END_ELEMENT:
                    $writer->endElement();
                    break;
            }
        }
    }
Exemple #18
0
    /**
     * @dataProvider xmlProvider
     */
    function testSerialize($expectedFallback, $input, $expected = null)
    {
        if (is_null($expected)) {
            $expected = $expectedFallback;
        }
        $writer = new Writer();
        $writer->namespaceMap = ['http://sabredav.org/ns' => null];
        $writer->openMemory();
        $writer->startDocument('1.0');
        //$writer->setIndent(true);
        $writer->write(['{http://sabredav.org/ns}root' => ['{http://sabredav.org/ns}fragment' => new XmlFragment($input)]]);
        $output = $writer->outputMemory();
        $expected = <<<XML
<?xml version="1.0"?>
<root xmlns="http://sabredav.org/ns"><fragment>{$expected}</fragment></root>
XML;
        $this->assertEquals($expected, $output);
    }
Exemple #19
0
 /**
  * The xmlSerialize method is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     switch ($this->value) {
         case SharingPlugin::ACCESS_NOTSHARED:
             $writer->writeElement('{DAV:}not-shared');
             break;
         case SharingPlugin::ACCESS_SHAREDOWNER:
             $writer->writeElement('{DAV:}shared-owner');
             break;
         case SharingPlugin::ACCESS_READ:
             $writer->writeElement('{DAV:}read');
             break;
         case SharingPlugin::ACCESS_READWRITE:
             $writer->writeElement('{DAV:}read-write');
             break;
         case SharingPlugin::ACCESS_NOACCESS:
             $writer->writeElement('{DAV:}no-access');
             break;
     }
 }
Exemple #20
0
 /**
  * Serializes a xCal or xCard object.
  *
  * @param Component $component
  *
  * @return string
  */
 static function writeXml(Component $component)
 {
     $writer = new Xml\Writer();
     $writer->openMemory();
     $writer->setIndent(true);
     $writer->startDocument('1.0', 'utf-8');
     if ($component instanceof Component\VCalendar) {
         $writer->startElement('icalendar');
         $writer->writeAttribute('xmlns', Parser\Xml::XCAL_NAMESPACE);
     } else {
         $writer->startElement('vcards');
         $writer->writeAttribute('xmlns', Parser\Xml::XCARD_NAMESPACE);
     }
     $component->xmlSerialize($writer);
     $writer->endElement();
     return $writer->outputMemory();
 }
Exemple #21
0
 /**
  * Overwrite the original method, so we can add some output
  * formatting for the XML.
  * @param  boolval $flush Flush memory after
  * @return string
  */
 public function outputMemory($flush = false)
 {
     // Beautify the XML output
     if ($this->formatOutput === true) {
         $dom = new \DOMDocument();
         $dom->formatOutput = true;
         $dom->loadXML(parent::outputMemory($flush));
         return $dom->saveXML();
     } else {
         return parent::outputMemory($flush);
     }
 }
 /**
  * @dataProvider dataProvider
  */
 function testSerializers($notification, $expected1, $expected2)
 {
     $this->assertEquals('foo', $notification->getId());
     $this->assertEquals('"1"', $notification->getETag());
     $writer = new Writer();
     $writer->namespaceMap = ['http://calendarserver.org/ns/' => 'cs'];
     $writer->openMemory();
     $writer->startDocument('1.0', 'UTF-8');
     $writer->startElement('{http://calendarserver.org/ns/}root');
     $writer->write($notification);
     $writer->endElement();
     $this->assertXmlStringEqualsXmlString($expected1, $writer->outputMemory());
     $writer = new Writer();
     $writer->namespaceMap = ['http://calendarserver.org/ns/' => 'cs', 'DAV:' => 'd'];
     $writer->openMemory();
     $writer->startDocument('1.0', 'UTF-8');
     $writer->startElement('{http://calendarserver.org/ns/}root');
     $notification->xmlSerializeFull($writer);
     $writer->endElement();
     $this->assertXmlStringEqualsXmlString($expected2, $writer->outputMemory());
 }
Exemple #23
0
    function testSerialize()
    {
        $value = ['{http://sabredav.org/ns}elem1' => null, '{http://sabredav.org/ns}elem2' => 'textValue', '{http://sabredav.org/ns}elem3' => ['{http://sabredav.org/ns}elem4' => 'text2', '{http://sabredav.org/ns}elem5' => null], '{http://sabredav.org/ns}elem6' => 'text3'];
        $writer = new Writer();
        $writer->namespaceMap = ['http://sabredav.org/ns' => null];
        $writer->openMemory();
        $writer->startDocument('1.0');
        $writer->setIndent(true);
        $writer->write(['{http://sabredav.org/ns}root' => new KeyValue($value)]);
        $output = $writer->outputMemory();
        $expected = <<<XML
<?xml version="1.0"?>
<root xmlns="http://sabredav.org/ns">
 <elem1/>
 <elem2>textValue</elem2>
 <elem3>
  <elem4>text2</elem4>
  <elem5/>
 </elem3>
 <elem6>text3</elem6>
</root>

XML;
        $this->assertEquals($expected, $output);
    }
 /**
  * @param $items
  * @return string
  */
 public function generateXML($items)
 {
     $this->writer->openMemory();
     $this->writer->startElement('properties');
     foreach ($items['data'] as $data) {
         $property = new Property();
         $property->propertyId = $data['property-id'];
         $property->dateListed = $data['date-listed'];
         $property->setPropertyType($data['property-type']);
         $property->setListingType($data['listing-type']);
         $property->link = $data['link'];
         $property->postalCode = $data['postal-code'];
         $property->city = $data['city'];
         $property->rooms = $data['rooms'];
         $property->bedrooms = $data['bedrooms'];
         $property->bathrooms = $data['bathrooms'];
         $property->propertySize = $data['property-size'];
         $property->landSize = $data['land-size'];
         $property->price = $data['price'];
         $property->images = $data['images'];
         $property->title = $data['title'];
         $property->description = $data['description'];
         $property->languages = $data['languages'];
         $this->writer->write(['property' => $property]);
     }
     $this->writer->endElement();
     return $this->writer->outputMemory();
 }
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     $writer->startElement('{' . Plugin::NS_CALDAV . '}calendar-data');
     $writer->writeAttributes(['content-type' => 'text/calendar', 'version' => '2.0']);
     $writer->endElement();
     // calendar-data
     $writer->startElement('{' . Plugin::NS_CALDAV . '}calendar-data');
     $writer->writeAttributes(['content-type' => 'application/calendar+json']);
     $writer->endElement();
     // calendar-data
 }
Exemple #26
0
 /**
  * @dataProvider dataProvider
  */
 function testSerializers($notification, $expected)
 {
     $notification = new InviteReply($notification);
     $this->assertEquals('foo', $notification->getId());
     $this->assertEquals('"1"', $notification->getETag());
     $simpleExpected = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<cs:root xmlns:cs="http://calendarserver.org/ns/"><cs:invite-reply/></cs:root>';
     $writer = new Writer();
     $writer->namespaceMap = ['http://calendarserver.org/ns/' => 'cs'];
     $writer->openMemory();
     $writer->startDocument('1.0', 'UTF-8');
     $writer->startElement('{http://calendarserver.org/ns/}root');
     $writer->write($notification);
     $writer->endElement();
     $this->assertEquals($simpleExpected, $writer->outputMemory());
     $writer = new Writer();
     $writer->contextUri = '/';
     $writer->namespaceMap = ['http://calendarserver.org/ns/' => 'cs', 'DAV:' => 'd'];
     $writer->openMemory();
     $writer->startDocument('1.0', 'UTF-8');
     $writer->startElement('{http://calendarserver.org/ns/}root');
     $notification->xmlSerializeFull($writer);
     $writer->endElement();
     $this->assertXmlStringEqualsXmlString($expected, $writer->outputMemory());
 }
Exemple #27
0
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     foreach ($this->properties as $propertyName => $propertyValue) {
         if (is_null($propertyValue)) {
             $writer->startElement("{DAV:}remove");
             $writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]);
             $writer->endElement();
         } else {
             $writer->startElement("{DAV:}set");
             $writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]);
             $writer->endElement();
         }
     }
 }
Exemple #28
0
 /**
  * The xmlSerialize metod is called during xml writing.
  *
  * Use the $writer argument to write its own xml serialization.
  *
  * An important note: do _not_ create a parent element. Any element
  * implementing XmlSerializble should only ever write what's considered
  * its 'inner xml'.
  *
  * The parent of the current element is responsible for writing a
  * containing element.
  *
  * This allows serializers to be re-used for different element names.
  *
  * If you are opening new elements, you must also close them again.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
     foreach ($this->sharees as $sharee) {
         if ($sharee->access === \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER) {
             $writer->startElement($cs . 'organizer');
         } else {
             $writer->startElement($cs . 'user');
             switch ($sharee->inviteStatus) {
                 case DAV\Sharing\Plugin::INVITE_ACCEPTED:
                     $writer->writeElement($cs . 'invite-accepted');
                     break;
                 case DAV\Sharing\Plugin::INVITE_DECLINED:
                     $writer->writeElement($cs . 'invite-declined');
                     break;
                 case DAV\Sharing\Plugin::INVITE_NORESPONSE:
                     $writer->writeElement($cs . 'invite-noresponse');
                     break;
                 case DAV\Sharing\Plugin::INVITE_INVALID:
                     $writer->writeElement($cs . 'invite-invalid');
                     break;
             }
             $writer->startElement($cs . 'access');
             switch ($sharee->access) {
                 case DAV\Sharing\Plugin::ACCESS_READWRITE:
                     $writer->writeElement($cs . 'read-write');
                     break;
                 case DAV\Sharing\Plugin::ACCESS_READ:
                     $writer->writeElement($cs . 'read');
                     break;
             }
             $writer->endElement();
             // access
         }
         $href = new \Sabre\DAV\Xml\Property\Href($sharee->href);
         $href->xmlSerialize($writer);
         if (isset($sharee->properties['{DAV:}displayname'])) {
             $writer->writeElement($cs . 'common-name', $sharee->properties['{DAV:}displayname']);
         }
         if ($sharee->comment) {
             $writer->writeElement($cs . 'summary', $sharee->comment);
         }
         $writer->endElement();
         // organizer or user
     }
 }
Exemple #29
0
    function testSerialize()
    {
        $writer = new Writer();
        $writer->namespaceMap = ['http://sabredav.org/ns' => null];
        $writer->openMemory();
        $writer->startDocument('1.0');
        $writer->setIndent(true);
        $writer->write(['{http://sabredav.org/ns}root' => new Cdata('<foo&bar>')]);
        $output = $writer->outputMemory();
        $expected = <<<XML
<?xml version="1.0"?>
<root xmlns="http://sabredav.org/ns"><![CDATA[<foo&bar>]]></root>

XML;
        $this->assertEquals($expected, $output);
    }
Exemple #30
0
    function testSerialize()
    {
        $writer = new Writer();
        $writer->namespaceMap = ['http://sabredav.org/ns' => null];
        $writer->openMemory();
        $writer->startDocument('1.0');
        $writer->setIndent(true);
        $writer->contextUri = 'http://example.org/';
        $writer->write(['{http://sabredav.org/ns}root' => ['{http://sabredav.org/ns}uri' => new Uri('/foo/bar')]]);
        $output = $writer->outputMemory();
        $expected = <<<XML
<?xml version="1.0"?>
<root xmlns="http://sabredav.org/ns">
 <uri>http://example.org/foo/bar</uri>
</root>

XML;
        $this->assertEquals($expected, $output);
    }