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


PHP XMLWriter::writeAttribute方法代码示例

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


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

示例1: to_html

 public function to_html($parent)
 {
     if (!$this->get_lang()) {
         $this->log("to_html() no lang", 'error');
         return null;
     }
     if (!$this->get_id()) {
         $this->log("to_html() no id", 'error');
         return null;
     }
     if (!$parent->get_request()->is_lang_ok($this->get_lang())) {
         return null;
     }
     $w = new XMLWriter();
     $w->openMemory();
     $w->startElement('div');
     $w->writeAttribute('class', 'subtitle');
     $w->startElement('a');
     $w->writeAttribute('class', 'subtitle_href');
     $w->writeAttribute('href', $parent->get_prefix_url() . '/download-' . $this->get_id() . '.html');
     $w->startElement('img');
     $w->writeAttribute('class', 'subtitle_lang');
     $w->writeAttribute('src', $parent->get_prefix_url() . '/images/flags/' . $this->get_lang() . '.gif');
     $w->endElement();
     $w->endElement();
     $w->endElement();
     return $w->flush();
 }
开发者ID:showi,项目名称:prog,代码行数:28,代码来源:wssubSubtitle.php

示例2: XMLWriter

 function impersonate_login($admin_user, $admin_pass, $site, $user)
 {
     //create a new xmlwriter object
     $xml = new XMLWriter();
     //using memory for string output
     $xml->openMemory();
     //set the indentation to true (if false all the xml will be written on one line)
     $xml->setIndent(true);
     //create the document tag, you can specify the version and encoding here
     $xml->startDocument();
     //Create an element
     $xml->startElement("tsRequest");
     $xml->startElement("credentials");
     $xml->writeAttribute("name", $admin_user);
     $xml->writeAttribute("password", $admin_pass);
     $xml->startElement("site");
     $xml->writeAttribute("contentUrl", strtoupper($site));
     $xml->endElement();
     //close contentUrl
     $xml->startElement("user");
     $xml->writeAttribute("id", $user);
     $xml->endElement();
     //close user
     $xml->endElement();
     //close credentials
     $xml->endElement();
     //close tsRequest
     return $data_string = $xml->outputMemory();
 }
开发者ID:elbarzata,项目名称:mulder,代码行数:29,代码来源:tableau_xml_helper.php

示例3: writeNamespaceAttributes

 private function writeNamespaceAttributes(\XMLWriter $xmlWriter)
 {
     $xmlWriter->writeAttribute(UrlSetInterface::XML_NAMESPACE_ATTRIBUTE, UrlSetInterface::XML_NAMESPACE_URI);
     $xmlWriter->writeAttribute(ImageInterface::XML_NAMESPACE_ATTRIBUTE, ImageInterface::XML_NAMESPACE_URI);
     $xmlWriter->writeAttribute(NewsInterface::XML_NAMESPACE_ATTRIBUTE, NewsInterface::XML_NAMESPACE_URI);
     $xmlWriter->writeAttribute(VideoInterface::XML_NAMESPACE_ATTRIBUTE, VideoInterface::XML_NAMESPACE_URI);
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:7,代码来源:UrlSetWriter.php

示例4: to_html

 public function to_html($parent)
 {
     $w = new XMLWriter();
     $w->openMemory();
     $w->startElement('div');
     $w->writeAttribute('class', 'show');
     $w->startElement('a');
     $w->writeAttribute('class', 'name');
     $w->writeAttribute('href', $parent->get_prefix_url() . $this->get_href());
     $w->text($this->get_name());
     $w->endElement();
     $img = null;
     if ($img = $this->get_img()) {
         $w->startElement('img');
         $w->writeAttribute('src', $parent->get_prefix_url() . $img);
         $w->writeAttribute('alt', $this->get_name());
         $w->endElement();
     }
     $str = "";
     $w->startElement('div');
     $w->writeAttribute('class', 'season_container');
     usort($this->seasons, 'wssub_cmp_num');
     foreach ($this->get_seasons() as $season) {
         if (!$season) {
             $this->log('to_html: "empty season', 'warn');
         }
         $str .= $season->to_html($parent);
     }
     $w->writeRaw($str);
     $w->endElement();
     $w->endElement();
     return $w->flush();
 }
开发者ID:showi,项目名称:prog,代码行数:33,代码来源:wssubTvShow.php

示例5: Encode

 public static function Encode($requestObject)
 {
     $soap = "";
     try {
         $writer = new XMLWriter();
         $writer->openMemory();
         $writer->startDocument();
         $writer->setIndent(4);
         $writer->startElement("soap:Envelope");
         $writer->writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
         $writer->writeAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
         $writer->writeAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
         $writer->startElement("soap:Body");
         $options = array(XML_SERIALIZER_OPTION_INDENT => '    ', XML_SERIALIZER_OPTION_LINEBREAKS => "\n", XML_SERIALIZER_OPTION_DEFAULT_TAG => '', XML_SERIALIZER_OPTION_TYPEHINTS => false, XML_SERIALIZER_OPTION_IGNORE_NULL => true, XML_SERIALIZER_OPTION_CLASSNAME_AS_TAGNAME => true);
         $serializer = new XML_Serializer($options);
         $result = $serializer->serialize($requestObject);
         if ($result === true) {
             $xml = $serializer->getSerializedData();
             $xml = str_replace('<>', '', $xml);
             $xml = str_replace('</>', '', $xml);
         }
         $writer->writeRaw($xml);
         $writer->endElement();
         $writer->endElement();
         $writer->endDocument();
         $soap = $writer->flush();
         $soap = str_replace("<?xml version=\"1.0\"?>", "", $soap);
     } catch (Exception $ex) {
         throw new Exception("Error occurred while Soap encoding");
     }
     return $soap;
 }
开发者ID:jobinpankajan,项目名称:WeGive,代码行数:32,代码来源:SOAPEncoder.php

示例6: setupStoreData

 protected function setupStoreData()
 {
     // Using XMLWriter because SimpleXML namespaces on attribute names
     $this->doc = new XMLWriter();
     $this->doc->openMemory();
     $this->doc->setIndent(true);
     $this->doc->setIndentString('    ');
     $this->doc->startDocument('1.0', 'UTF-8');
     $this->doc->startElement('feed');
     $this->doc->writeAttribute('xmlns', 'http://www.w3.org/2005/Atom');
     $this->doc->writeAttribute('xmlns:g', 'http://base.google.com/ns/1.0');
     $this->doc->writeElement('title', $this->getConfig('title'));
     $this->doc->startElement('link');
     $this->doc->writeAttribute('rel', 'self');
     $this->doc->writeAttribute('href', $this->_store->getBaseUrl());
     $this->doc->endElement();
     $date = new Zend_Date();
     $this->doc->writeElement('updated', $date->get(Zend_Date::ATOM));
     $this->doc->startElement('author');
     $this->doc->writeElement('name', $this->getConfig('author'));
     $this->doc->endElement();
     $url = $this->_store->getBaseUrl();
     $day = $date->toString('yyyy-MM-dd');
     $path = $this->getConfig('output');
     $filename = $path . '/' . str_replace('+', '-', strtolower(urlencode($this->_store->getName()))) . '-products.xml';
     $this->doc->writeElement('id', 'tag:' . $url . ',' . $day . ':' . $filename);
 }
开发者ID:0l1v1er,项目名称:MagentoExtensions,代码行数:27,代码来源:Cron.php

示例7: to_html

 public function to_html($parent)
 {
     $w = new XMLWriter();
     $w->openMemory();
     $w->startElement('div');
     $w->writeAttribute('class', 'season');
     $w->startElement('div');
     $w->writeAttribute('class', 'season_name');
     $w->text("Saison " . $this->get_num());
     $w->endElement();
     $w->startElement('div');
     $w->writeAttribute('class', 'episode_container');
     $str = "";
     usort($this->episodes, 'wssub_cmp_num');
     foreach ($this->episodes as $ep) {
         if (!$ep->get_num()) {
             $this->log("Bad ep with no number: " . $ep->to_string(), 'warn');
             continue;
         }
         $str .= $ep->to_html($parent);
     }
     $w->writeRaw($str);
     $w->endElement();
     $w->endElement();
     return $w->flush();
 }
开发者ID:showi,项目名称:prog,代码行数:26,代码来源:wssubSeason.php

示例8: addTest

 public function addTest($test)
 {
     if ($this->finalized) {
         throw new PHP_CodeCoverage_RuntimeException('Coverage Report already finalized');
     }
     $this->writer->startElement('covered');
     $this->writer->writeAttribute('by', $test);
     $this->writer->endElement();
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:9,代码来源:Coverage.php

示例9: _addNumber

 /**
  * add number
  * 
  * @param integer $_number
  * @param string $_type
  */
 protected function _addNumber($_number, $_type)
 {
     $this->_writer->startElement("number");
     $this->_writer->writeAttribute("type", $_type);
     $this->_writer->writeAttribute("quickdial", "");
     $this->_writer->writeAttribute("vanity", "");
     $this->_writer->writeAttribute("prio", "");
     $this->_writer->text($_number);
     $this->_writer->endElement();
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:16,代码来源:FritzBox.php

示例10: doProcess

 protected function doProcess($inputPath, $outputPath)
 {
     $sitemap = Yaml::parse(file_get_contents($inputPath));
     if (!isset($sitemap['locations'])) {
         throw new PieCrustException("No locations were defined in the sitemap.");
     }
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->startDocument('1.0', 'utf-8');
     $xml->startElement('urlset');
     $xml->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
     foreach ($sitemap['locations'] as $loc) {
         $xml->startElement('url');
         // loc
         $locUrl = $this->pieCrust->getConfig()->getValueUnchecked('site/root') . ltrim($loc['url'], '/');
         $xml->writeElement('loc', $locUrl);
         // lastmod
         $locLastMod = null;
         if (isset($loc['lastmod'])) {
             $locLastMod = $loc['lastmod'];
         } else {
             if (isset($loc['lastmod_path'])) {
                 $fullPath = $this->pieCrust->getRootDir() . ltrim($loc['lastmod_path'], '/\\');
                 $locLastMod = date('c', filemtime($fullPath));
             } else {
                 $urlInfo = UriParser::parseUri($this->pieCrust, $loc['url']);
                 if ($urlInfo) {
                     if (is_file($urlInfo['path'])) {
                         $locLastMod = date('c', filemtime($urlInfo['path']));
                     }
                 }
             }
         }
         if (!$locLastMod) {
             throw new PieCrustException("No idea what '" . $loc['url'] . "' is. Please specify a 'lastmod' time, or 'lastmod_path' path.");
         }
         $xml->writeElement('lastmod', $locLastMod);
         // changefreq
         if (isset($loc['changefreq'])) {
             $xml->writeAttribute('changefreq', $loc['changefreq']);
         }
         // priority
         if (isset($loc['priority'])) {
             $xml->writeAttribute('priority', $loc['priority']);
         }
         $xml->endElement();
     }
     $xml->endElement();
     $xml->endDocument();
     $markup = $xml->outputMemory(true);
     file_put_contents($outputPath, $markup);
 }
开发者ID:omnicolor,项目名称:bulletphp-site,代码行数:53,代码来源:SitemapProcessor.php

示例11: write

 public function write(PlayerLocationInterface $playerLocation, \XMLWriter $xmlWriter)
 {
     $xmlWriter->startElement('video:player_loc');
     if ($playerLocation->allowEmbed()) {
         $xmlWriter->writeAttribute('allow_embed', $playerLocation->allowEmbed());
     }
     if ($playerLocation->autoPlay()) {
         $xmlWriter->writeAttribute('autoplay', $playerLocation->autoPlay());
     }
     $xmlWriter->text($playerLocation->location());
     $xmlWriter->endElement();
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:12,代码来源:PlayerLocationWriter.php

示例12: toXml

 public function toXml(XMLWriter $x)
 {
     $x->writeAttribute('type', 'redirect');
     $x->writeElement('url', $this->_url);
     $x->startElement('params');
     foreach ($this->_params as $k => $v) {
         $x->startElement('param');
         $x->writeAttribute('name', $k);
         $x->text($v);
         $x->endElement();
     }
     $x->endElement();
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:13,代码来源:Redirect.php

示例13: to_html

 public function to_html($parent)
 {
     $w = new XMLWriter();
     $w->openMemory();
     $w->startElement('div');
     $w->writeAttribute('class', 'log_message');
     $w->startElement('div');
     $w->writeAttribute('class', 'log_message_' . $this->type);
     $w->writeRaw('<div class="log_class">' . $this->class . '</div>::<div class="log_msg">' . $this->msg . '</div>');
     $w->endElement();
     $w->endElement();
     return $w->flush();
 }
开发者ID:showi,项目名称:prog,代码行数:13,代码来源:wssubLogMessage.php

示例14: write

 public function write(PriceInterface $price, \XMLWriter $xmlWriter)
 {
     $xmlWriter->startElement('video:price');
     $xmlWriter->writeAttribute('currency', $price->currency());
     if ($price->type()) {
         $xmlWriter->writeAttribute('type', $price->type());
     }
     if ($price->resolution()) {
         $xmlWriter->writeAttribute('resolution', $price->resolution());
     }
     $xmlWriter->text(number_format($price->value(), 2));
     $xmlWriter->endElement();
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:13,代码来源:PriceWriter.php

示例15: getObject

 /**
  * @return \XMLWriter
  */
 public function getObject()
 {
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openMemory();
     $xmlWriter->startDocument('1.0', 'UTF-8');
     $xmlWriter->setIndent(true);
     $xmlWriter->writePi('xml-stylesheet', 'type="text/xsl" href="./sitemap_css.xsl"');
     $xmlWriter->startElement('urlset');
     $xmlWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $xmlWriter->writeAttribute('xmlns:image', 'http://www.google.com/schemas/sitemap-image/1.1');
     $xmlWriter->writeAttribute('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd');
     $xmlWriter->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
     return $xmlWriter;
 }
开发者ID:webowy,项目名称:sitemap,代码行数:17,代码来源:Sitemap.php


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