PHP | DOMImplementation createDocumentType() function
Last Updated :
19 Feb, 2020
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:
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.
Return Value: This function returns DOMDocumentType node with its ownerDocument set to NULL.
Exceptions: This function throws DOM_NAMESPACE_ERR, if there is an error with the namespace, as determined by $qualifiedName.
Below given programs illustrate the DOMImplementation::createDocumentType() function in PHP:
Program 1:
<?php
$imp = new DOMImplementation();
$dtd = $imp ->createDocumentType(
echo $dtd ->systemId;
?>
|
Output:
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd
Program 2:
<?php
$imp = new DOMImplementation();
$dtd = $imp ->createDocumentType( 'GeeksforGeeks' );
echo $dtd ->name;
?>
|
Output:
GeeksforGeeks
Reference: https://www.php.net/manual/en/domimplementation.createdocumenttype.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...