Open In App

PHP | XMLWriter endDtdElement() Function

Last Updated : 07 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The XMLWriter::endDtdElement() function is an inbuilt function in PHP which is used to end current DTD element. DTD stands for Document Type Definition which defines the structure and the legal elements and attributes of an XML document. DTD aren’t visible in a webpage because they act like comments.

Syntax:

bool XMLWriter::endDtdElement( void )

Parameters: This function doesn’t accept any parameter.

Return Value: This function returns TRUE on success or FALSE on failure.

Below examples illustrate the XMLWriter::endDtdElement() function in PHP:

Example 1:




<?php
  
// Create a new XMLWriter instance
$writer = new XMLWriter();
     
// Create the output stream as PHP
$writer->openURI('php://output');
     
// Start the document
$writer->startDocument('1.0', 'UTF-8');
  
// Start the Dtd Element
$writer->startDtdElement('div');
  
// End the Dtd Element
$writer->endDtdElement();
     
// End the document
$writer->endDocument();
?>


Output:

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT div>

Example 2:




<?php
  
// Create a new XMLWriter instance
$writer = new XMLWriter();
     
// Create the output stream as PHP
$writer->openURI('php://output');
     
// Start the document
$writer->startDocument('1.0', 'UTF-8');
  
// Start the Dtd Element
$writer->startDtdElement('element_not_visible');
  
// End the Dtd Element
$writer->endDtdElement();
  
// Add text to Document
$writer->text('Hello World !');
     
// End the document
$writer->endDocument();
?>


Output:

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT element_not_visible>Hello World !


Similar Reads

PHP | XMLWriter endAttribute() Function
The XMLWriter::endAttribute() function is an inbuilt function in PHP which is used to end an attribute which is started using XMLWriter::startAttribute() function. Syntax: bool XMLWriter::endAttribute( void ) Parameters: This function doesn’t accept any parameter. Return Value: This function returns TRUE on success or FALSE on failure. Below exampl
1 min read
PHP XMLWriter endCdata() Function
The XMLWriter::endCdata() function is an inbuilt function in PHP which is used to end current CDATA. CDATA is block of text which is not parsed by the parser but are recognized as markup. Syntax: bool XMLWriter::endCdata( void ) Parameters: This function doesn’t accept any parameter. Return Value: This function returns TRUE on success or FALSE on f
2 min read
PHP | XMLWriter endComment() Function
The XMLWriter::endComment() function is an inbuilt function in PHP which is used to end a comment which is started using XMLWriter::startComment() function. Syntax: bool XMLWriter::endComment( void ) Parameters: This function doesn’t accept any parameter. Return Value: This function returns TRUE on success or FALSE on failure. Below examples illust
1 min read
PHP | XMLWriter endDocument() Function
The XMLWriter::endDocument() function is an inbuilt function in PHP which is used to end current document. Syntax: bool XMLWriter::endDocument( void ) Parameters: This function doesn’t accept any parameter. Return Value: This function returns TRUE on success or FALSE on failure. Below examples illustrate the XMLWriter::endDocument() function in PHP
1 min read
PHP | XMLWriter startDtdAttlist() Function
The XMLWriter::startDtdAttlist() function is an inbuilt function in PHP which is used to start DTD AttList. DTD stands for Document Type Definition which defines the structure and the legal elements and attributes of an XML document. In a DTD, attributes are declared with an ATTLIST declaration. Syntax: bool XMLWriter::startDtdAttlist( string $name
1 min read
PHP | XMLWriter endDtdAttlist() Function
The XMLWriter::endDtdAttlist() function is an inbuilt function in PHP which is used to end current DTD AttList. DTD stands for Document Type Definition which defines the structure and the legal elements and attributes of an XML document. DTD aren't visible in a webpage because they act like comments. In a DTD, attributes are declared with an ATTLIS
1 min read
PHP | XMLWriter endDtdEntity() Function
The XMLWriter::endDtdEntity() function is an inbuilt function in PHP which is used to end current DTD entity. DTD stands for Document Type Definition which defines the structure and the legal elements and attributes of an XML document. DTD isn’t visible on a webpage because they act like comments. Entities are used to define shortcuts to special ch
2 min read
PHP | XMLWriter endDtd() Function
The XMLWriter::endDtd() function is an inbuilt function in PHP which is used to end current DTD which is started using XMLWriter::startDtd() function. DTD stands for Document Type Definition which defines the structure and the legal elements and attributes of an XML document. DTD aren’t visible in a webpage because they act like comments. Syntax: b
1 min read
PHP | XMLWriter endElement() Function
The XMLWriter::endElement() function is an inbuilt function in PHP which is used to end current element which is started using XMLWriter::startElement() function. Syntax: bool XMLWriter::endElement( void ) Parameters:This function doesn’t accept any parameter. Return Value: This function returns TRUE on success and FALSE on failure. Below examples
1 min read
PHP | XMLWriter endPi() Function
The XMLWriter::endPi() function is an inbuilt function in PHP which is used to end the current PI which is started using XMLWriter::startPi() function. Processing instructions (PIs) allow documents to contain instructions which are not part of the character data of the document, but are passed through to the XML. PIs are not visible in the web-page
2 min read