note 50011 deleted from function.dom-domimplementation-createdocumenttype by didou
| From: | didou@php.net | Date: | Sat, 02 Apr 2005 22:32:05 +0000 |
| Subject: | note 50011 deleted from function.dom-domimplementation-createdocumenttype by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87373@lists.php.net to get a copy of this message | ||
Note Submitter: roger4a45 at yahoo dot es
----
If you need to create a XML Document and you need to attach a DTD file (or a SChema File) you can
use this fuction to create a DOMDocument rather than DOMDocument COntructor.
//NOT TESTED
function CreateXMLDocumentWithAttachedDTD ($RootElement,$DTDFile)
{
//Create an DOMImplementation instance to make this job
$implementation = new DOMImplementation;
//Create a SYSTEM Entry to add at our XML Document.
$dtd = $implementation->createDocumentType($RootElement, "",$DTDFile);
//Generate a DOMDocument with a DTF
$DOMXMLDoc = $impl->createDocument("", "", $dtd);
//Now, you can work with this object to add new Elements or what you need.
return $DOMXMLDoc;
}