當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XMLWriter::endDtd方法代碼示例

本文整理匯總了PHP中XMLWriter::endDtd方法的典型用法代碼示例。如果您正苦於以下問題:PHP XMLWriter::endDtd方法的具體用法?PHP XMLWriter::endDtd怎麽用?PHP XMLWriter::endDtd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XMLWriter的用法示例。


在下文中一共展示了XMLWriter::endDtd方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

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

示例2: 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::endDtd方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。