<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.domimplementation.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'domimplementation.createdocumenttype.php',
    1 => 'DOMImplementation::createDocumentType',
    2 => 'Creates an empty DOMDocumentType object',
  ),
  'up' => 
  array (
    0 => 'class.domimplementation.php',
    1 => 'DOMImplementation',
  ),
  'prev' => 
  array (
    0 => 'domimplementation.createdocument.php',
    1 => 'DOMImplementation::createDocument',
  ),
  'next' => 
  array (
    0 => 'domimplementation.hasfeature.php',
    1 => 'DOMImplementation::hasFeature',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/dom/domimplementation/createdocumenttype.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="domimplementation.createdocumenttype" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DOMImplementation::createDocumentType</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">DOMImplementation::createDocumentType</span> &mdash; <span class="dc-title">
   Creates an empty DOMDocumentType object
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-domimplementation.createdocumenttype-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>DOMImplementation::createDocumentType</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$qualifiedName</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$publicId</code><span class="initializer"> = &quot;&quot;</span></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$systemId</code><span class="initializer"> = &quot;&quot;</span></span>): <span class="type"><span class="type"><a href="class.domdocumenttype.php" class="type DOMDocumentType">DOMDocumentType</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Creates an empty <span class="classname"><a href="class.domdocumenttype.php" class="classname">DOMDocumentType</a></span> object. Entity 
   declarations and notations are not made available. Entity reference 
   expansions and default attribute additions do not occur.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-domimplementation.createdocumenttype-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">qualifiedName</code></dt>
     <dd>
      <p class="para">
       The qualified name of the document type to create.
      </p>
     </dd>
    
    
     <dt><code class="parameter">publicId</code></dt>
     <dd>
      <p class="para">
       The external subset public identifier.
      </p>
     </dd>
    
    
     <dt><code class="parameter">systemId</code></dt>
     <dd>
      <p class="para">
       The external subset system identifier.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-domimplementation.createdocumenttype-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   A new <span class="classname"><a href="class.domdocumenttype.php" class="classname">DOMDocumentType</a></span> node with its 
   <code class="literal">ownerDocument</code> set to <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on error.
  </p>
 </div>

 <div class="refsect1 errors" id="refsect1-domimplementation.createdocumenttype-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="simpara">
   May throw a <span class="exceptionname"><a href="class.domexception.php" class="exceptionname">DOMException</a></span> with the
   following error codes:
  </p>
  <p class="para">
   <dl>
    
     <dt><strong><code><a href="dom.constants.php#constant.dom-namespace-err">DOM_NAMESPACE_ERR</a></code></strong></dt>
     <dd>
      <p class="para">
       Raised if there is an error with the namespace, as determined by 
       <code class="parameter">qualifiedName</code>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 changelog" id="refsect1-domimplementation.createdocumenttype-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.0.0</td>
       <td>
        Calling this function statically will
        now throw an <span class="classname"><a href="class.error.php" class="classname">Error</a></span>.
        Previously, an <strong><code><a href="errorfunc.constants.php#constant.e-deprecated">E_DEPRECATED</a></code></strong> was raised.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-domimplementation.createdocumenttype-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Creating a document with an attached DTD</strong></p>
    <div class="example-contents">
 <div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">// Creates an instance of the DOMImplementation class<br /></span><span style="color: #0000BB">$imp </span><span style="color: #007700">= new </span><span style="color: #0000BB">DOMImplementation</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Creates a DOMDocumentType instance<br /></span><span style="color: #0000BB">$dtd </span><span style="color: #007700">= </span><span style="color: #0000BB">$imp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createDocumentType</span><span style="color: #007700">(</span><span style="color: #DD0000">'graph'</span><span style="color: #007700">, </span><span style="color: #DD0000">''</span><span style="color: #007700">, </span><span style="color: #DD0000">'graph.dtd'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Creates a DOMDocument instance<br /></span><span style="color: #0000BB">$dom </span><span style="color: #007700">= </span><span style="color: #0000BB">$imp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createDocument</span><span style="color: #007700">(</span><span style="color: #DD0000">""</span><span style="color: #007700">, </span><span style="color: #DD0000">""</span><span style="color: #007700">, </span><span style="color: #0000BB">$dtd</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Set other properties<br /></span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">encoding </span><span style="color: #007700">= </span><span style="color: #DD0000">'UTF-8'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">standalone </span><span style="color: #007700">= </span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Create an empty element<br /></span><span style="color: #0000BB">$element </span><span style="color: #007700">= </span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createElement</span><span style="color: #007700">(</span><span style="color: #DD0000">'graph'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Append the element<br /></span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">appendChild</span><span style="color: #007700">(</span><span style="color: #0000BB">$element</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Retrieve and print the document<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">saveXML</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;
&lt;!DOCTYPE graph SYSTEM &quot;graph.dtd&quot;&gt;
&lt;graph/&gt;</pre>
</div>
    </div>
   </div>
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-domimplementation.createdocumenttype-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="domimplementation.createdocument.php" class="methodname" rel="rdfs-seeAlso">DOMImplementation::createDocument()</a> - Creates a DOMDocument object of the specified type with its document element</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>