本文整理汇总了PHP中XMLWriter::endDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLWriter::endDocument方法的具体用法?PHP XMLWriter::endDocument怎么用?PHP XMLWriter::endDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLWriter
的用法示例。
在下文中一共展示了XMLWriter::endDocument方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filter
public function filter($value)
{
$this->_initReaderWriter();
$this->_reader->XML($value);
$this->_doXmlTrim();
$this->_writer->endDocument();
return $this->_writer->outputMemory();
}
示例2: finalize
public function finalize()
{
$this->xml->endElement();
//root element
$this->xml->endDocument();
$this->xml->flush();
return $this->filename;
}
示例3: end
public function end()
{
if (!$this->documentEnded) {
$this->xmlWriter->endDocument();
$this->xmlWriter->flush();
$this->documentEnded = true;
}
}
示例4: 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;
}
示例5: 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();
}
示例6: populateNodes
/**
* Insert tree-structured array as nodes in XMLWriter
* and end the current Document.
*
* @param $data Array - tree-structured array
*
* @throws \Genesis\Exceptions\InvalidArgument
*
* @return void
*/
public function populateNodes($data)
{
if (!\Genesis\Utils\Common::isValidArray($data)) {
throw new \Genesis\Exceptions\InvalidArgument('Invalid data structure');
}
// Ensure that the Array position is 0
reset($data);
$this->iterateArray(key($data), reset($data));
// Finish the document
$this->context->endDocument();
}
示例7: __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);
}
示例8: 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();
}
示例9: 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;
}
示例10: index
public function index()
{
$writter = new \XMLWriter();
$writter->openMemory();
$writter->startDocument('1.0', 'UTF-8');
$writter->setIndent(TRUE);
$writter->startElement('rss');
$writter->writeAttribute('version', '2.0');
$writter->startElement('channel');
//header
$writter->writeElement('title', 'phpMint RSS');
$writter->writeElement('link', 'mein LINK');
$writter->writeElement('description', 'Ein PHP-Blog über PHP, jQuery, JavaScript und weiteren Technik-Themen.');
//body
foreach ($this->getPosts() as $key => $post) {
$writter->startElement('item');
$writter->writeElement('title', $post['title']);
$writter->writeElement('pubDate', $post['datum']);
$writter->writeElement('link', $post['slug']);
$writter->writeElement('description', $post['preview']);
$writter->endElement();
}
while ($writter->endElement() !== false) {
continue;
}
$writter->endDocument();
$test = $writter->outputMemory(TRUE);
$loger = new \Loger('session');
$loger->write($test);
$this->response->addHeader('Content-type: text/xml; charset=UTF-8');
$this->response->setOutput($test);
}
示例11: 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;
}
示例12: endDocument
public function endDocument()
{
$this->error = false;
$this->endElement();
// ocs
parent::endDocument();
}
示例13: toXMLFooter
/**
* Returns the MARCXML collection footer
*
* This method produces an XML representation of a MARC record that
* attempts to adhere to the MARCXML standard documented at
* http://www.loc.gov/standards/marcxml/
*
* @return string representation of MARC record in MARCXML format
*/
function toXMLFooter()
{
$this->xmlwriter->endElement();
// end collection
$this->xmlwriter->endDocument();
return $this->xmlwriter->outputMemory();
}
示例14: saveToFile
/**
* @param string $fileToSave
* @param number $offsetStart
* @param number $limit
* @param null | string $suffix
*
* @return string
*/
protected function saveToFile($fileToSave, $offsetStart, $limit, $suffix = null)
{
$writer = new \XMLWriter();
$path = pathinfo($fileToSave);
$filePath = $path['dirname'] . '/' . $path['filename'];
if (!is_null($suffix)) {
$filePath .= self::SEPERATOR . $suffix;
}
if (empty($path['extension'])) {
$filePath .= self::XML_EXT;
} else {
$filePath .= '.' . $path['extension'];
}
$writer->openURI($filePath);
$writer->startDocument('1.0', 'UTF-8');
$writer->setIndent(true);
$writer->startElement('sitemapindex');
$writer->writeAttribute('xmlns', self::SCHEMA);
for ($i = $offsetStart; $i < count($this->items) && $i < $limit; $i++) {
$item = $this->items[$i];
$writer->startElement('sitemap');
$writer->writeElement('loc', $item['url']);
$writer->writeElement('lastmod', $item['modified']->format(ModifiableInterface::MODIFIED_DATE_FORMAT));
$writer->endElement();
}
$writer->endElement();
$writer->endDocument();
return $filePath;
}
示例15: export
/**
* Exports the node data of all nodes in the given sub-tree
* by writing them to the given XMLWriter.
*
* @param string $startingPointNodePath path to the root node of the sub-tree to export. The specified node will not be included, only its sub nodes.
* @param string $workspaceName
* @param \XMLWriter $xmlWriter
* @param boolean $tidy
* @param boolean $endDocument
* @param string $resourceSavePath
* @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 \XMLWriter
*/
public function export($startingPointNodePath = '/', $workspaceName = 'live', \XMLWriter $xmlWriter = null, $tidy = true, $endDocument = true, $resourceSavePath = null, $nodeTypeFilter = null)
{
$this->propertyMappingConfiguration = new ImportExportPropertyMappingConfiguration($resourceSavePath);
$this->exceptionsDuringExport = array();
$this->exportedNodePaths = array();
if ($startingPointNodePath !== '/') {
$startingPointParentPath = substr($startingPointNodePath, 0, strrpos($startingPointNodePath, '/'));
$this->exportedNodePaths[$startingPointParentPath] = true;
}
$this->xmlWriter = $xmlWriter;
if ($this->xmlWriter === null) {
$this->xmlWriter = new \XMLWriter();
$this->xmlWriter->openMemory();
$this->xmlWriter->setIndent($tidy);
$this->xmlWriter->startDocument('1.0', 'UTF-8');
}
$this->securityContext->withoutAuthorizationChecks(function () use($startingPointNodePath, $workspaceName, $nodeTypeFilter) {
$nodeDataList = $this->findNodeDataListToExport($startingPointNodePath, $workspaceName, $nodeTypeFilter);
$this->exportNodeDataList($nodeDataList);
});
if ($endDocument) {
$this->xmlWriter->endDocument();
}
$this->handleExceptionsDuringExport();
return $this->xmlWriter;
}