ID: 33085 Updated by: [EMAIL PROTECTED] Reported By: verniera at free dot fr -Status: Open +Status: Bogus Bug Type: DOM XML related Operating System: Windows XP PHP Version: 5.0.4 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You cant load a DTD after the fact. Either reload the serialized doc you just created and validate that or build the document by hand (cannot use load methods doing this) using something like: $doc = $impl->createDocument(NULL, 'root', $dtd); $root = $doc->documentElement; $root->appendChild(xxx).... $doc->validate(); Previous Comments: ------------------------------------------------------------------------ [2005-05-20 16:49:07] verniera at free dot fr Description: ------------ Adding a DTD to an already loaded document properly adds the given Element and Text to the document, but doesn't seem to update the document->doctype properly. Workaround found: Create a new document with the DTD and import the root node of the document. Note: It's my first try at reporting a bug, so I apologize if if it is not clear. Reproduce code: --------------- $impl= new DomImplementation; $dtd= $impl->createDocumentType("test", "", "loctest.dtd"); $dom=DOMDocument::load('C:\\Inetpub\\wwwroot\\cgi-bin\\testsDom\\test.xml'); $dom->standalone = "no"; $dom->insertBefore($dtd, $dom->firstChild); if ($dom->validate()) echo "Valid"; else echo "NOT Valid"; Expected result: ---------------- "Valid" OR "NOT Valid" OR An error indicating that I cannot add the DTD element Actual result: -------------- Notice: DOMDocument::validate() [function.validate]: No DTD given in XML-Document in C:\Inetpub\wwwroot\cgi-bin\testsDom\addDtd.php on line 26 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33085&edit=1