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


PHP XMLWriter::outputMemory方法代码示例

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


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

示例1: addPerfil

 public function addPerfil($nome, $dataNascimento, $idade, $codUsuario)
 {
     # Instancia do objeto XMLWriter
     $xml = new XMLWriter();
     # Cria memoria para armazenar a saida
     $xml->openMemory();
     # Inicia o cabeçalho do documento XML
     $xml->startDocument('1.0', 'iso-8859-1');
     # Adiciona/Inicia um Elemento / Nó Pai <item>
     $xml->startElement("perfil");
     #  Adiciona um Nó Filho <quantidade> e valor 8
     $xml->writeElement("nome", $nome);
     $xml->writeElement("datanascimento", $dataNascimento);
     $xml->writeElement("idade", $idade);
     $xml->writeElement("codusuario", $codUsuario);
     #  Finaliza o Nó Pai / Elemento <Item>
     $xml->endElement();
     #  Configura a saida do conteúdo para o formato XML
     header('Content-type: text/xml');
     # Imprime os dados armazenados
     print $xml->outputMemory(true);
     # Salvando o arquivo em disco
     # retorna erro se o header foi definido
     # retorna erro se outputMemory já foi chamado
     $file = fopen("cod" . $codUsuario . ".xml", "w+");
     fwrite($file, $xml->outputMemory(true));
     fclose($file);
 }
开发者ID:pereiraMichel,项目名称:redeunavida,代码行数:28,代码来源:funcaoXML.php

示例2: testAmountIsWeightIsOmmittedIfFalse

 public function testAmountIsWeightIsOmmittedIfFalse()
 {
     $this->record->setAmountIsWeight(false);
     $this->gen->build();
     $xml = $this->xmlWriter->outputMemory(true);
     $this->assertNotTag(array('tag' => 'AMOUNT_IS_WEIGHT'), $xml, '', false);
 }
开发者ID:georgeh,项目名称:php-beerxml,代码行数:7,代码来源:MiscTest.php

示例3: filter

 public function filter($value)
 {
     $this->_initReaderWriter();
     $this->_reader->XML($value);
     $this->_doXmlTrim();
     $this->_writer->endDocument();
     return $this->_writer->outputMemory();
 }
开发者ID:shevron,项目名称:stoa,代码行数:8,代码来源:XmlTrim.php

示例4: serialize

 /**
  * @param array $ticket
  * @return string
  */
 public function serialize($ticket)
 {
     $this->buffer->writeRaw('<?xml version="1.0" encoding="utf-8"?>');
     $this->buffer->startElement('ticket');
     $this->generateTicket($ticket);
     $this->buffer->endElement();
     return $this->buffer->outputMemory();
 }
开发者ID:ChristophJaecksF4H,项目名称:tico_test,代码行数:12,代码来源:XMLSerializer.php

示例5: export

 /**
  * Fetches the site with the given name and exports it into XML.
  *
  * @param array<Site> $sites
  * @param boolean $tidy Whether to export formatted XML
  * @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "TYPO3.Neos:Page", "!TYPO3.Neos:Page,TYPO3.Neos:Text")
  * @return string
  */
 public function export(array $sites, $tidy = false, $nodeTypeFilter = null)
 {
     $this->xmlWriter = new \XMLWriter();
     $this->xmlWriter->openMemory();
     $this->xmlWriter->setIndent($tidy);
     $this->exportSites($sites, $nodeTypeFilter);
     return $this->xmlWriter->outputMemory(true);
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:16,代码来源:SiteExportService.php

示例6: finalize

 public function finalize()
 {
     $this->writer->endElement();
     $fragment = $this->contextNode->ownerDocument->createDocumentFragment();
     $fragment->appendXML($this->writer->outputMemory());
     $this->contextNode->parentNode->replaceChild($fragment, $this->contextNode);
     $this->finalized = true;
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:8,代码来源:Coverage.php

示例7: export

 /**
  * Fetches the site with the given name and exports it into XML.
  *
  * @param array<Site> $sites
  * @param boolean $tidy Whether to export formatted XML
  * @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "TYPO3.Neos:Page", "!TYPO3.Neos:Page,TYPO3.Neos:Text")
  * @return string
  */
 public function export(array $sites, $tidy = FALSE, $nodeTypeFilter = NULL)
 {
     $this->xmlWriter = new \XMLWriter();
     $this->xmlWriter->openMemory();
     $this->xmlWriter->setIndent($tidy);
     $this->exportSites($sites, $nodeTypeFilter);
     return $this->xmlWriter->outputMemory(TRUE);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:16,代码来源:SiteExportService.php

示例8: toString

 /**
  * Get feed as XML string
  *
  * @return string
  */
 public function toString()
 {
     if (!$this->output) {
         $this->xml->endDocument();
         $this->output = $this->xml->outputMemory(true);
     }
     // Remove empty elements
     $this->output = preg_replace('#<[^>]*/>#', '', $this->output);
     return $this->output;
 }
开发者ID:pfeyssaguet,项目名称:guzzle-aws,代码行数:15,代码来源:AbstractFeed.php

示例9: write

 /**
  * Converts array with export data to XML format.
  *
  * @param array $array
  *
  * @return string
  */
 public function write(array $array)
 {
     $this->xmlWriter->openMemory();
     $this->xmlWriter->setIndent($this->formatOutput);
     $this->xmlWriter->setIndentString('    ');
     $this->xmlWriter->startDocument('1.0', 'UTF-8');
     $this->fromArray($array);
     $this->xmlWriter->endDocument();
     return $this->xmlWriter->outputMemory();
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:17,代码来源:CXmlExportWriter.php

示例10: testConvertsBooleanToString

 public function testConvertsBooleanToString()
 {
     $this->record->setCalcBoilVolume(true);
     $this->generator->build();
     $xml = $this->xml->outputMemory(true);
     $this->assertTag(array('tag' => 'CALC_BOIL_VOLUME', 'content' => 'TRUE'), $xml, '', false);
     $this->record->setCalcBoilVolume(false);
     $this->generator->build();
     $xml = $this->xml->outputMemory(true);
     $this->assertTag(array('tag' => 'CALC_BOIL_VOLUME', 'content' => 'FALSE'), $xml, '', false);
 }
开发者ID:georgeh,项目名称:php-beerxml,代码行数:11,代码来源:EquipmentTest.php

示例11: __toString

 public function __toString()
 {
     $this->writer->openMemory();
     $this->writer->startDocument($this->version, $this->encoding);
     $this->writer->startElement($this->root);
     foreach ($this->data as $key => $value) {
         $this->writeElement($key, $value);
     }
     $this->writer->endElement();
     $this->writer->endDocument();
     return $this->writer->outputMemory(true);
 }
开发者ID:wells5609,项目名称:wp-app,代码行数:12,代码来源:Document.php

示例12: to_xml

 /**
  * Convert the request data into XML.
  *
  * @since 4.3.0
  * @return string
  */
 protected function to_xml()
 {
     if (!empty($this->request_xml)) {
         return $this->request_xml;
     }
     $this->xml = new XMLWriter();
     // Create XML document in memory
     $this->xml->openMemory();
     // Set XML version & encoding
     $this->xml->startDocument('1.0', 'UTF-8');
     $request_data = $this->get_request_data();
     SV_WC_Helper::array_to_xml($this->xml, $this->get_root_element(), $request_data[$this->get_root_element()]);
     $this->xml->endDocument();
     return $this->request_xml = $this->xml->outputMemory();
 }
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:21,代码来源:abstract-sv-wc-api-xml-request.php

示例13: writeRequest

 /**
  * Write the service document in Atom format.
  * 
  * @param Object &$dummy Dummy object
  * 
  * @return string
  */
 public function writeRequest(&$dummy)
 {
     $this->_xmlWriter = new \XMLWriter();
     $this->_xmlWriter->openMemory();
     $this->_xmlWriter->startElementNs(null, ODataConstants::ATOM_PUBLISHING_SERVICE_ELEMENT_NAME, ODataConstants::APP_NAMESPACE);
     $this->_xmlWriter->writeAttributeNs(ODataConstants::XML_NAMESPACE_PREFIX, ODataConstants::XML_BASE_ATTRIBUTE_NAME, null, $this->_baseUri);
     $this->_xmlWriter->writeAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, self::ATOM_NAMESPACE_PREFIX, null, ODataConstants::ATOM_NAMESPACE);
     $this->_xmlWriter->writeAttributeNs(ODataConstants::XMLNS_NAMESPACE_PREFIX, self::APP_NAMESPACE_PREFIX, null, ODataConstants::APP_NAMESPACE);
     $this->_xmlWriter->startElement(ODataConstants::ATOM_PUBLISHING_WORKSPACE_ELEMNT_NAME);
     $this->_xmlWriter->startElementNs(self::ATOM_NAMESPACE_PREFIX, ODataConstants::ATOM_TITLE_ELELMET_NAME, null);
     $this->_xmlWriter->text(ODataConstants::ATOM_PUBLISHING_WORKSPACE_DEFAULT_VALUE);
     $this->_xmlWriter->endElement();
     foreach ($this->_metadataQueryproviderWrapper->getResourceSets() as $resourceSetWrapper) {
         //start collection node
         $this->_xmlWriter->startElement(ODataConstants::ATOM_PUBLISHING_COLLECTION_ELEMENT_NAME);
         $this->_xmlWriter->writeAttribute(ODataConstants::ATOM_HREF_ATTRIBUTE_NAME, $resourceSetWrapper->getName());
         //start title node
         $this->_xmlWriter->startElementNs(self::ATOM_NAMESPACE_PREFIX, ODataConstants::ATOM_TITLE_ELELMET_NAME, null);
         $this->_xmlWriter->text($resourceSetWrapper->getName());
         //end title node
         $this->_xmlWriter->endElement();
         //end collection node
         $this->_xmlWriter->endElement();
     }
     //End workspace and service nodes
     $this->_xmlWriter->endElement();
     $this->_xmlWriter->endElement();
     $serviceDocumentInAtom = $this->_xmlWriter->outputMemory(true);
     return $serviceDocumentInAtom;
 }
开发者ID:i-geo,项目名称:odataphpprod,代码行数:37,代码来源:ServiceDocumentWriter.php

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

示例15: creaXml

 public function creaXml()
 {
     $writer = new XMLWriter();
     //$writer->setIndent(true);
     $csc = 1;
     $writer->openMemory();
     $writer->startDocument();
     $writer->startElement("ROOT");
     while (!$this->rs->EOF) {
         $writer->startElement("registro");
         $writer->startElement("CSC");
         $writer->text($csc);
         $writer->endElement();
         for ($x = 0; $x < $this->rs->FieldCount(); $x++) {
             $fld = $this->rs->FetchField($x);
             $writer->startElement(strtoupper($fld->name));
             $writer->text($this->rs->fields[strtoupper($fld->name)]);
             $writer->endElement();
         }
         $writer->endElement();
         $this->rs->MoveNext();
         $csc++;
     }
     $writer->endElement();
     $writer->endDocument();
     $algo = $writer->outputMemory(true);
     return $algo;
 }
开发者ID:kractos26,项目名称:orfeo,代码行数:28,代码来源:RecordSetToXml.class.php


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