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


PHP Xml::createComment方法代码示例

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


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

示例1: __default_handler

 static function __default_handler($parser, $data)
 {
     if ($data === "<![CDATA[") {
         return;
     }
     if ($data === "]]>") {
         return;
     }
     if ("<!--" === _hx_substr($data, 0, 4)) {
         Xml::$build->addChild(Xml::createComment(_hx_substr($data, 4, strlen($data) - 7)));
     } else {
         Xml::$build->addChild(Xml::createPCData($data));
     }
 }
开发者ID:komcdo,项目名称:winnow,代码行数:14,代码来源:Xml.class.php

示例2: buildXML

 /**
  * Builds the complete xml document.
  * @return string
  * @access private
  */
 protected function buildXML()
 {
     $hp = new Xml('1.0', 'utf-8');
     $hp->formatOutput = true;
     // begin hp items
     $hpitems = $hp->createElement('hotPadsItems');
     $hpitems->setAttribute("version", '2.1');
     $comm = $hp->createComment('Generated at ' . gmdate(DATE_RFC822));
     $hpitems->appendChild($comm);
     if (is_array($this->properties)) {
         foreach ($this->properties as $prop) {
             $noerrors = $this->validate($prop);
             if ($noerrors === true) {
                 // Build listing
                 $listing = $hp->createElement('Listing');
                 // Listing attributes
                 $listing->setAttribute("id", $prop->id);
                 $listing->setAttribute("type", $prop->type);
                 $listing->setAttribute("propertyType", $prop->property_type);
                 // Property details
                 $listing->appendChild($this->hpTextNode('name', false, $hp, $prop));
                 $listing->appendChild($this->hpTextNode('unit', false, $hp, $prop));
                 $listing->appendChild($this->hpTextNode('street', false, $hp, $prop));
                 $listing->appendChild($this->hpTextNode('city', false, $hp, $prop));
                 $listing->appendChild($this->hpTextNode('state', false, $hp, $prop));
                 $listing->appendChild($this->hpTextNode('zip', false, $hp, $prop));
                 $listing->appendChild($this->hpTextNode('country', false, $hp, $prop));
                 // Contact details
                 $listing->appendChild($this->hpTextNode('contactName', 'contact_name', $hp, $prop));
                 $listing->appendChild($this->hpTextNode('contactEmail', 'contact_email', $hp, $prop));
                 $listing->appendChild($this->hpTextNode('contactPhone', 'contact_phone', $hp, $prop));
                 $listing->appendChild($this->hpTextNode('contactFax', 'contact_fax', $hp, $prop));
                 // Descriptions and urls
                 $listing->appendChild($this->hpTextNode('previewMessage', 'preview_message', $hp, $prop));
                 $listing->appendChild($this->hpTextNode('description', false, $hp, $prop));
                 $listing->appendChild($this->hpTextNode('terms', false, $hp, $prop));
                 $listing->appendChild($this->hpTextNode('website', 'website_url', $hp, $prop));
                 $listing->appendChild($this->hpTextNode('virtualTourUrl', 'vr_url', $hp, $prop));
                 // Photos
                 if ($prop->photos) {
                     foreach ($prop->photos as $img) {
                         $photo = $hp->createElement('ListingPhoto');
                         $photo->setAttribute("source", $img['source']);
                         $listing->appendChild($photo);
                     }
                 }
                 // Additional data
                 $listing->appendChild($this->hpTextNode('price', false, $hp, $prop));
                 $listing->appendChild($this->hpTextNode('pricingFrequency', 'price_freq', $hp, $prop));
                 $listing->appendChild($this->hpTextNode('HOA-Fee', 'hoa_maint', $hp, $prop));
                 $listing->appendChild($this->hpTextNode('numBedrooms', 'bedrooms', $hp, $prop));
                 $listing->appendChild($this->hpTextNode('numFullBaths', 'full_bath', $hp, $prop));
                 $listing->appendChild($this->hpTextNode('numHalfBaths', 'half_bath', $hp, $prop));
                 $listing->appendChild($this->hpTextNode('squareFeet', 'sqft', $hp, $prop));
                 $hpitems->appendChild($listing);
             }
         }
         $hp->appendChild($hpitems);
         return $hp->saveXML();
     }
 }
开发者ID:viveleroi,项目名称:hotpads,代码行数:66,代码来源:Hotpads.php


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