Iterate over the children of the DOMDocument object, you will find a
DOMDocumentType (getNodeType()==DOCUMENT_TYPE_NODE) and replace it with
a new one created using DOMDocument::createDocumentType("collection","",
"newdtd.dtd")
Alberto
Daniel Burrell wrote:
I have parsed a document into dom form and retrieved it using
doc = parser->getDocument();
How can I access the
<!DOCTYPE collection SYSTEM "dtd.dtd">
specifically I want to be able to change "dtd.dtd" to something else.
in the following xml file?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE collection SYSTEM "dtd.dtd">
<collection>
<description>
Some recipes used for the XML tutorial.
</description>
<recipe>
<title>Beef Parmesan with Garlic Angel Hair Pasta</title>
<ingredient name="beef cube steak" amount="1.5" unit="pound"/>
<preparation>
<step>
Preheat oven to 350 degrees F (175 degrees C).
</step>
</preparation>
<comment>
Make the meat ahead of time, and refrigerate over night, the acid in
the
tomato sauce will tenderize the meat even more. If you do this, save
the
mozzarella till the last minute.
</comment>
<nutrition calories="1167" fat="23" carbohydrates="45" protein="32"/>
</recipe>
</collection>