Dom\CharacterData::remove

Removes the character data node

Description

public void Dom\CharacterData::remove()

Removes the character data node.

Parameters

This function has no parameters.

Return Values

No value is returned.

Examples

Example #1 Dom\CharacterData::remove example

Removes the character data.

<?php
$doc = Dom\XMLDocument::createFromString("<container><![CDATA[hello]]><world/></container>");
$cdata = $doc->documentElement->firstChild;

$cdata->remove();

echo $doc->saveXML();
?>

The above example will output:

<?xml version="1.0"?>
<container><world/></container>

See Also

  • Dom\ChildNode::remove
  • Dom\CharacterData::after
  • Dom\CharacterData::before
  • Dom\CharacterData::replaceWith
  • Dom\Node::removeChild