note 45765 deleted from ref.dom by didou

From: Date: Sat, 02 Apr 2005 20:42:22 +0000
Subject: note 45765 deleted from ref.dom by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-87361@lists.php.net to get a copy of this message
Note Submitter: jw at jwscripts dot com ---- The following shows how to add a DTD to an XML document: <?php // Create an instance of the DomImplementation class $impl = new DomImplementation; // Create an instance of the DomDocumentType class by // calling the DomImplementation::createDocumentType() method // (arguments: doctype_name, doctype_public, doctype_system) $dtd = $impl->createDocumentType("graph", "", "graph.dtd"); // Create an instance of the DomDocument class by // calling the DomImplementation::createDocument() method // (arguments: NS_URL, NS_PREFIX, DomDocumentType_instance) $dom = $impl->createDocument("", "", $dtd); // Set other properties $dom->encoding = "UTF-8"; $dom->standalone = "no"; // Create an empty element $element = $dom->createElement("graph"); // Append the element $dom->appendChild($element); // Retrieve and print the document print $dom->saveXML()); /* Result: ========= <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE graph SYSTEM "graph.dtd"> <graph/> */ ?>

« previous php.notes (#87361) next »