What are the best practices for accessing and manipulating text nodes in XML elements using PHP?

When accessing and manipulating text nodes in XML elements using PHP, it is important to use the appropriate functions provided by PHP's XML manipulation libraries. This includes functions like `simplexml_load_string()` to parse the XML, `->children()` to access child elements, and `->nodeValue` to get or set the text content of an element.

$xml = '<root><element>Text Content</element></root>';
$doc = simplexml_load_string($xml);

// Accessing text content of an element
$textContent = $doc->element->nodeValue;
echo $textContent;

// Modifying text content of an element
$doc->element = 'New Text Content';
echo $doc->asXML();