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


PHP Xml\Writer类代码示例

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


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

示例1: xmlSerializeValue

 /**
  * 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());
 }
开发者ID:ddolbik,项目名称:sabre-vobject,代码行数:15,代码来源:TimeStamp.php

示例2: 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)
 {
     $collations = ['i;ascii-casemap', 'i;octet', 'i;unicode-casemap'];
     foreach ($collations as $collation) {
         $writer->writeElement('{' . Plugin::NS_CALDAV . '}supported-collation', $collation);
     }
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:26,代码来源:SupportedCollationSet.php

示例3: getXmlFor

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

示例4: xmlSerialize

 /**
  * @param Writer $writer
  * @return void
  */
 function xmlSerialize(Writer $writer)
 {
     // This is required
     $writer->write(['loc' => $this->location]);
     // This is optional
     $this->add($writer, ['lastmod']);
 }
开发者ID:laravelista,项目名称:bard,代码行数:11,代码来源:Sitemap.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)
 {
     $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]]);
 }
开发者ID:netoholic,项目名称:store-integrator,代码行数:27,代码来源:AmazonProduct.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->getValue() as $val) {
         $writer->startElement('{DAV:}supported-method');
         $writer->writeAttribute('name', $val);
         $writer->endElement();
     }
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:27,代码来源:SupportedMethodSet.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->components as $component) {
         $writer->startElement('{' . Plugin::NS_CALDAV . '}comp');
         $writer->writeAttributes(['name' => $component]);
         $writer->endElement();
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:27,代码来源:SupportedCalendarComponentSet.php

示例8: add

 /**
  * 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}]);
         }
     }
 }
开发者ID:laravelista,项目名称:bard,代码行数:14,代码来源:Common.php

示例9: 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

示例10: 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->getResponses() as $response) {
         $writer->writeElement('{DAV:}response', $response);
     }
     if ($syncToken = $this->getSyncToken()) {
         $writer->writeElement('{DAV:}sync-token', $syncToken);
     }
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:24,代码来源:MultiStatus.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)
 {
     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

示例12: 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)
 {
     if ($this->canBeShared) {
         $writer->writeElement('{' . Plugin::NS_CALENDARSERVER . '}can-be-shared');
     }
     if ($this->canBePublished) {
         $writer->writeElement('{' . Plugin::NS_CALENDARSERVER . '}can-be-published');
     }
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:28,代码来源:AllowedSharingModes.php

示例13: write

 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();
 }
开发者ID:Radiergummi,项目名称:anacronism,代码行数:10,代码来源:XmlTest.php

示例14: 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)
 {
     switch ($this->value) {
         case self::TRANSPARENT:
             $writer->writeElement('{' . Plugin::NS_CALDAV . '}transparent');
             break;
         case self::OPAQUE:
             $writer->writeElement('{' . Plugin::NS_CALDAV . '}opaque');
             break;
     }
 }
开发者ID:pageer,项目名称:sabre-dav,代码行数:30,代码来源:ScheduleCalendarTransp.php

示例15: 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->write(['{DAV:}remove' => [$propertyName => $propertyValue]]);
            } else {
                $writer->write(['{DAV:}set' => [$propertyName => $propertyValue]]);
            }

        }

    }
开发者ID:nikosv,项目名称:openeclass,代码行数:32,代码来源:PropPatch.php


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