5
我使用導出的XML文件中的PHP:如何在export xml中添加DOCTYPE?
$xmldoc = new DOMDocument();
$xmldoc->formatOutput = true;
$xmldoc->encoding="Shift_JIS";
// create root nodes
$root = $xmldoc->createElement("TableData");
$xmldoc->appendChild($root);
$xmldoc->save($filename);
結果:
<?xml version="1.0" encoding="Shift_JIS"?>
<TableData> </TableData>
現在,我想添加一行<!DOCTYPE TableDef SYSTEM "TableData.dtd">
,如:
<?xml version="1.0" encoding="Shift_JIS"?>
<!DOCTYPE TableDef SYSTEM "TableData.dtd">
<TableData> </TableData>
如何在添加DOCTYPE
導出xml?謝謝。
檢查[的DOMImplementation :: createDocumentType](http://www.php.net/manual/en/domimplementation.createdocumenttype.php) – air4x
http://pointbeing.net/weblog/2009/03/adding- A-DOCTYPE聲明對A-DOM文檔功能於php.html – Adam