當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。