本文整理汇总了PHP中XMLWriter::setIndent方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLWriter::setIndent方法的具体用法?PHP XMLWriter::setIndent怎么用?PHP XMLWriter::setIndent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLWriter
的用法示例。
在下文中一共展示了XMLWriter::setIndent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: __construct
/**
* Create new XMLWriter
*
* @param int $tempLocation Temporary storage location
* @param string $tempFolder Temporary storage folder
*/
public function __construct($tempLocation = self::STORAGE_MEMORY, $tempFolder = './')
{
// Create internal XMLWriter
$this->xmlWriter = new \XMLWriter();
// Open temporary storage
if ($tempLocation == self::STORAGE_MEMORY) {
$this->xmlWriter->openMemory();
} else {
// Create temporary filename
$this->tempFile = @tempnam($tempFolder, 'xml');
// Open storage
if ($this->xmlWriter->openUri($this->tempFile) === false) {
// Fallback to memory...
$this->xmlWriter->openMemory();
}
}
// Set xml Compatibility
$compatibility = Settings::getCompatibility();
if ($compatibility) {
$this->xmlWriter->setIndent(false);
$this->xmlWriter->setIndentString('');
} else {
$this->xmlWriter->setIndent(true);
$this->xmlWriter->setIndentString(' ');
}
}
示例3: __construct
/**
* Create new XMLWriter
*
* @param int $tempLocation Temporary storage location
* @param string $tempFolder Temporary storage folder
*/
public function __construct($tempLocation = self::STORAGE_MEMORY, $tempFolder = './')
{
// Create internal XMLWriter
$this->xmlWriter = new \XMLWriter();
// Open temporary storage
if ($tempLocation == self::STORAGE_MEMORY) {
$this->xmlWriter->openMemory();
} else {
// Create temporary filename
$this->tempFile = @tempnam($tempFolder, 'xml');
// Fallback to memory when temporary file cannot be used
// @codeCoverageIgnoreStart
// Can't find any test case. Uncomment when found.
if ($this->xmlWriter->openUri($this->tempFile) === false) {
$this->xmlWriter->openMemory();
}
// @codeCoverageIgnoreEnd
}
// Set xml Compatibility
$compatibility = Settings::hasCompatibility();
if ($compatibility) {
$this->xmlWriter->setIndent(false);
$this->xmlWriter->setIndentString('');
} else {
$this->xmlWriter->setIndent(true);
$this->xmlWriter->setIndentString(' ');
}
}
示例4: __construct
/**
* Create a new PHPPowerPoint_Shared_XMLWriter instance
*
* @param int $pTemporaryStorage Temporary storage location
* @param string $pTemporaryStorageFolder Temporary storage folder
*/
public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = './')
{
// Create internal XMLWriter
$this->_xmlWriter = new XMLWriter();
// Open temporary storage
if ($pTemporaryStorage == self::STORAGE_MEMORY) {
$this->_xmlWriter->openMemory();
} else {
// Create temporary filename
$this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
// Open storage
if ($this->_xmlWriter->openUri($this->_tempFileName) === false) {
// Fallback to memory...
$this->_xmlWriter->openMemory();
}
}
// Set default values
// proposed to be false in production version
$this->_xmlWriter->setIndent(true);
//$this->_xmlWriter->setIndent(false);
// Set indent
// proposed to be '' in production version
$this->_xmlWriter->setIndentString(' ');
//$this->_xmlWriter->setIndentString('');
}
示例5: __construct
/**
* Set and instantiate new UTF-8 XML document
*/
public function __construct()
{
$this->context = new \XMLWriter();
$this->context->openMemory();
$this->context->startDocument('1.0', 'UTF-8');
$this->context->setIndent(true);
$this->context->setIndentString(" ");
}
示例6: __construct
/**
* Constructor
*
* @param PMF_Faq $faq PMF_Faq object
* @param PMF_Category $category PMF_Category object
*
* return PMF_Export_Xhtml
*/
public function __construct(PMF_Faq $faq, PMF_Category $category)
{
$this->faq = $faq;
$this->category = $category;
$this->xml = new XMLWriter();
$this->xml->openMemory();
$this->xml->setIndent(true);
}
示例7: __construct
public function __construct($documentUri, $version = '1.0', $encoding = 'utf-8')
{
$this->xmlWriter = new \XMLWriter();
$this->elementWriter = new ElementWriter($this->xmlWriter);
$this->xmlWriter->openUri($documentUri);
$this->xmlWriter->setIndent(true);
$this->xmlWriter->startDocument($version, $encoding);
}
示例8: __construct
/**
* Constructor
*/
public function __construct()
{
$this->map = new \XMLWriter();
$this->map->openMemory();
$this->map->startDocument('1.0', 'utf-8');
$this->map->setIndent(true);
$this->startSitemap();
}
示例9: __construct
/**
* Construct a new instance of ConnectionParams.
*
* @param array &$connectionParams Connection parameters for database.
*/
public function __construct(&$connectionParams)
{
$this->connectionParams = $connectionParams;
$this->xmlWriter = new \XMLWriter();
$this->xmlWriter->openMemory();
$this->xmlWriter->startDocument('1.0', 'UTF-8', 'yes');
$this->xmlWriter->setIndent(4);
}
示例10: startDocument
/**
* Start document
*
* @param mixed $data
*/
public function startDocument($data)
{
$this->checkStartDocument($data);
$this->isEmpty = true;
$this->xmlWriter = new \XMLWriter();
$this->xmlWriter->openMemory();
$this->xmlWriter->setIndent($this->formatOutput);
$this->xmlWriter->startDocument('1.0', 'UTF-8');
}
示例11: start
/**
* Defined by ReportInterface.
*
* @see ReportInterface::start()
*/
public function start()
{
$this->writer = new XMLWriter();
$this->writer->openMemory();
$this->writer->setIndent(true);
$this->writer->setIndentString(' ');
$this->writer->startDocument('1.0', 'UTF-8');
$this->writer->startElement('checkstyle');
$this->writer->writeAttribute('version', '5.5');
}
示例12: 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();
}
示例13: initialize
public function initialize(Config $config, $directory, $filenameWithDate = false)
{
$this->setFilename($config, $directory, $filenameWithDate);
$this->xml = new \XMLWriter();
$this->xml->openUri($this->filename);
$this->xml->startDocument('1.0', 'utf-8');
$this->xml->setIndent(true);
$this->xml->setIndentString(' ');
$this->xml->writeComment('list of ' . $config->getClassName());
$this->elementName = strtolower($config->getClassNameLastPart());
$this->xml->startElement(strtolower($config->getClassNameLastPart(true)));
}
示例14: _getWriter
protected function _getWriter()
{
$writer = new XMLWriter();
$writer->openMemory();
if ($this->_format == self::OUTPUT_PRETTY) {
$writer->setIndent(TRUE);
$writer->startDocument('1.0', 'UTF-8');
} else {
$writer->setIndent(FALSE);
$writer->startDocument();
}
return $writer;
}
示例15: getWriter
/**
* Return an XML writer that will be used
* to produce XML-RPC requests and responses.
*
* \retval XMLWriter
* XML writer to use to produce documents.
*/
protected function getWriter()
{
$writer = new \XMLWriter();
$writer->openMemory();
if ($this->indent) {
$writer->setIndent(true);
$writer->startDocument('1.0', 'UTF-8');
} else {
$writer->setIndent(false);
$writer->startDocument();
}
return $writer;
}