PHP | DOMImplementation createDocumentType() function
Last Updated :
19 Feb, 2020
Improve
The DOMImplementation::createDocumentType() function is an inbuilt function in PHP which is used to create an empty DOMDocumentType object. Entity declarations and notations are not available.
Syntax:
php
Output:
php
Output:
DOMDocumentType DOMImplementation::createDocumentType ( string $qualifiedName = NULL, string $publicId = NULL, string $systemId = NULL )Parameters:This function accepts three parameters as mentioned above and described below:
- $qualifiedName (Optional): It specifies the qualified name of the document type to create.
- $publicId (Optional): It specifies the qualified name of the external subset public identifier.
- $systemId (Optional): It specifies the external subset system identifier.
<?php
// Creates an instance of the DOMImplementation class
$imp = new DOMImplementation();
// Creates a DOMDocumentType instance
$dtd = $imp->createDocumentType(
'svg:svg', null, 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
// Get the systemId
echo $dtd->systemId;
?>
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtdProgram 2:
<?php
// Creates an instance of the DOMImplementation class
$imp = new DOMImplementation();
// Creates a DOMDocumentType instance
$dtd = $imp->createDocumentType('GeeksforGeeks');
// Get the name
echo $dtd->name;
?>
GeeksforGeeksReference: https://www.php.net/manual/en/domimplementation.createdocumenttype.php