I cannot figure out how to get domxml to generate the DOCTYPE information when outputting the XML document. Here is the code to generate the simple XML document:
<?php
$doc = domxml_new_doc("1.0");
$root = $doc->create_element("FooBar");
$doc->append_child($root);
print $doc->dump_mem(true,"US-ASCII");
?>
When I run it from the command line, it outputs:
<?xml version="1.0" encoding="US-ASCII"?>
<FooBar/>
But, what I need is for it to also contain a DOCTYPE entry, as such:
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE FooBar SYSTEM "http://some.site.com/DTD/FooBar.dtd">
<FooBar/>
I cannot find any function or method to do this from within domxml so I have resorted to a hack with string manipulation to force it. Any suggestions on how to do this within domxml so I don't have to use a hack?
I'm using PHP-4.4.1 with DOM/XML API Version 20020815, libxml Version 20622.
-Rod