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


PHP XMLWriter::startDtd方法代码示例

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


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

示例1: file_get_contents

<?php

/* $Id$ */
$doc_dest = '001.xml';
$xw = new XMLWriter();
$xw->openUri($doc_dest);
$xw->startDtd('foo', NULL, 'urn:bar');
$xw->endDtd();
$xw->startElement('foo');
$xw->writeElementNS('foo', 'bar', 'urn:foo', 'dummy content');
$xw->endElement();
// Force to write and empty the buffer
$output_bytes = $xw->flush(true);
echo file_get_contents($doc_dest);
unset($xw);
unlink('001.xml');
开发者ID:gleamingthecube,项目名称:php,代码行数:16,代码来源:ext_xmlwriter_tests_OO_006.php

示例2: xmlwriter_flush

<?php

$xw = xmlwriter_open_memory();
xmlwriter_start_document($xw, NULL, "UTF-8");
xmlwriter_start_dtd($xw, "root");
xmlwriter_write_dtd_entity($xw, "ent2", "val2");
xmlwriter_end_dtd($xw);
xmlwriter_start_element($xw, "root");
xmlwriter_end_document($xw);
print xmlwriter_flush($xw, true);
print "\n";
$xw = new XMLWriter();
$xw->openMemory();
$xw->startDocument(NULL, "UTF-8");
$xw->startDtd("root");
$xw->writeDtdEntity("c", NULL, 0, "-//W3C//TEXT copyright//EN", "http://www.w3.org/xmlspec/copyright.xml");
$xw->endDtd();
$xw->startElement("root");
$xw->endDocument();
print $xw->flush(true);
开发者ID:badlamer,项目名称:hhvm,代码行数:20,代码来源:bug39504.php

示例3: XMLWriter

<?php

/**
 * @link https://github.com/corpsepk/yii2-yandex-market-yml
 * @copyright Copyright (c) 2016 Corpsepk
 * @license http://opensource.org/licenses/MIT
 *
 * @var $shop corpsepk\yml\models\Shop
 */
use yii\helpers\Html;
$writer = new XMLWriter();
$writer->openUri('php://output');
$writer->startDocument('1.0', 'UTF-8');
$writer->startDtd('yml_catalog SYSTEM "shops.dtd"');
$writer->endDtd();
$writer->startElement('yml_catalog');
$writer->writeAttribute('date', date('Y-m-d H:i'));
$writer->startElement('shop');
$writer->writeElement('name', Html::encode($shop->name));
$writer->writeElement('company', Html::encode($shop->company));
$writer->writeElement('url', Html::encode($shop->url));
foreach ($shop->optionalAttributes as $attribute) {
    if (empty($shop->{$attribute})) {
        continue;
    }
    if (is_array($shop->{$attribute})) {
        foreach ($shop->{$attribute} as $value) {
            $writer->writeElement($attribute, Html::encode($value));
        }
    } else {
        $writer->writeElement($attribute, Html::encode($shop->{$attribute}));
开发者ID:corpsepk,项目名称:yii2-yandex-market-yml,代码行数:31,代码来源:index.php


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