当前位置: 首页>>代码示例>>PHP>>正文


PHP Writer::endElement方法代码示例

本文整理汇总了PHP中Sabre\Xml\Writer::endElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Writer::endElement方法的具体用法?PHP Writer::endElement怎么用?PHP Writer::endElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sabre\Xml\Writer的用法示例。


在下文中一共展示了Writer::endElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateXML

 /**
  * @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();
 }
开发者ID:mabasic,项目名称:crozilla-integration,代码行数:32,代码来源:Crozilla.php

示例2: xmlSerialize

 /**
  * 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->locks as $lock) {
         $writer->startElement('{DAV:}activelock');
         $writer->startElement('{DAV:}lockscope');
         if ($lock->scope === LockInfo::SHARED) {
             $writer->writeElement('{DAV:}shared');
         } else {
             $writer->writeElement('{DAV:}exclusive');
         }
         $writer->endElement();
         // {DAV:}lockscope
         $writer->startElement('{DAV:}locktype');
         $writer->writeElement('{DAV:}write');
         $writer->endElement();
         // {DAV:}locktype
         if (!self::$hideLockRoot) {
             $writer->startElement('{DAV:}lockroot');
             $writer->writeElement('{DAV:}href', $writer->contextUri . $lock->uri);
             $writer->endElement();
             // {DAV:}lockroot
         }
         $writer->writeElement('{DAV:}depth', $lock->depth == DAV\Server::DEPTH_INFINITY ? 'infinity' : $lock->depth);
         $writer->writeElement('{DAV:}timeout', 'Second-' . $lock->timeout);
         $writer->startElement('{DAV:}locktoken');
         $writer->writeElement('{DAV:}href', 'opaquelocktoken:' . $lock->token);
         $writer->endElement();
         // {DAV:}locktoken
         $writer->writeElement('{DAV:}owner', new XmlFragment($lock->owner));
         $writer->endElement();
         // {DAV:}activelock
     }
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:48,代码来源:LockDiscovery.php

示例3: xmlSerialize

 /**
  * 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
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:30,代码来源:SupportedCalendarData.php

示例4: xmlSerialize

 /**
  * 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();
         }
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:33,代码来源:PropPatch.php

示例5: xmlSerialize

 /**
  * 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();
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:27,代码来源:CurrentUserPrivilegeSet.php

示例6: xmlSerialize

 /**
  * 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();
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:27,代码来源:SupportedCalendarComponentSet.php

示例7: xmlSerialize

 /**
  * 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();
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:27,代码来源:SupportedMethodSet.php

示例8: xmlSerialize

 /**
  * 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
     }
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:28,代码来源:SupportedAddressData.php

示例9: __construct

 /**
  * @param \VirCom\ePUAP2\Requests\Login $request
  * @param \Sabre\Xml\Writer $xmlWriter
  */
 public function __construct(Requests\Login $request, Xml\Writer $xmlWriter)
 {
     $xmlWriter->openMemory();
     $xmlWriter->setIndent(true);
     $xmlWriter->startDocument();
     $xmlWriter->startElement('samlp:AuthnRequest');
     $xmlWriter->writeAttribute('xmlns:samlp', 'urn:oasis:names:tc:SAML:2.0:protocol');
     $xmlWriter->writeAttribute('ID', microtime(true));
     $xmlWriter->writeAttribute('IssueInstant', (new \DateTime())->format('Y-m-d\\TH:i:s\\Z'));
     $xmlWriter->writeAttribute('Version', '2.0');
     $xmlWriter->writeAttribute('Destination', $request->getUrl());
     $xmlWriter->writeAttribute('IsPassive', 'false');
     $xmlWriter->writeAttribute('AssertionConsumerServiceURL', $request->getResponseUrl());
     $xmlWriter->startElement('saml:Issuer');
     $xmlWriter->writeAttribute('xmlns:saml', 'urn:oasis:names:tc:SAML:2.0:assertion');
     $xmlWriter->write($request->getApplicationId());
     $xmlWriter->endElement();
     $xmlWriter->endElement();
     $this->parsedMessage = $xmlWriter->outputMemory();
 }
开发者ID:vircom,项目名称:epuap2,代码行数:24,代码来源:Login.php

示例10: __construct

 /**
  * @param string $url
  * @param \VirCom\ePUAP2\Requests\Logout $request
  * @param \Sabre\Xml\Writer $xmlWriter
  */
 public function __construct(Requests\Logout $request, Xml\Writer $xmlWriter)
 {
     $xmlWriter->openMemory();
     $xmlWriter->setIndent(true);
     $xmlWriter->startDocument();
     $xmlWriter->startElement('samlp:LogoutRequest');
     $xmlWriter->writeAttribute('xmlns:samlp', 'urn:oasis:names:tc:SAML:2.0:protocol');
     $xmlWriter->writeAttribute('xmlns:saml', 'urn:oasis:names:tc:SAML:2.0:assertion');
     $xmlWriter->writeAttribute('ID', microtime(true));
     $xmlWriter->writeAttribute('IssueInstant', (new \DateTime())->format('Y-m-d\\TH:i:s\\Z'));
     $xmlWriter->writeAttribute('Version', '2.0');
     $xmlWriter->startElement('saml:Issuer');
     $xmlWriter->write($request->getApplicationId());
     $xmlWriter->endElement();
     $xmlWriter->startElement('samlp:NameID');
     $xmlWriter->write($request->getUsername());
     $xmlWriter->endElement();
     $xmlWriter->endElement();
     $this->parsedMessage = $xmlWriter->outputMemory();
 }
开发者ID:vircom,项目名称:epuap2,代码行数:25,代码来源:Logout.php

示例11: xmlSerialize

    /**
     * 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;
            }
        }
    }
开发者ID:sebbie42,项目名称:casebox,代码行数:66,代码来源:XmlFragment.php

示例12: testSerializers

 /**
  * @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());
 }
开发者ID:jakobsack,项目名称:sabre-dav,代码行数:24,代码来源:SystemStatusTest.php

示例13: testSerializers

 /**
  * @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());
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:27,代码来源:InviteReplyTest.php

示例14: xmlSerializeFull

 /**
  * This method serializes the entire notification, as it is used in the
  * response body.
  *
  * @param Writer $writer
  * @return void
  */
 function xmlSerializeFull(Writer $writer)
 {
     $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
     switch ($this->type) {
         case self::TYPE_LOW:
             $type = 'low';
             break;
         case self::TYPE_MEDIUM:
             $type = 'medium';
             break;
         default:
         case self::TYPE_HIGH:
             $type = 'high';
             break;
     }
     $writer->startElement($cs . 'systemstatus');
     $writer->writeAttribute('type', $type);
     if ($this->description) {
         $writer->writeElement($cs . 'description', $this->description);
     }
     if ($this->href) {
         $writer->writeElement('{DAV:}href', $this->href);
     }
     $writer->endElement();
     // systemstatus
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:33,代码来源:SystemStatus.php

示例15: addImages

 /**
  * @param Writer $writer
  */
 private function addImages(Writer $writer)
 {
     $writer->startElement('images');
     foreach ($this->images as $image) {
         $writer->startElement('image');
         $writer->write($image);
         $writer->endElement();
     }
     $writer->endElement();
 }
开发者ID:mabasic,项目名称:crozilla-integration,代码行数:13,代码来源:Property.php


注:本文中的Sabre\Xml\Writer::endElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。