|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-05-20 17:20 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 20:00:01 2025 UTC |
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