What is the best way to access nodes with special characters in PHP when working with XML files?

When working with XML files in PHP, accessing nodes with special characters can be tricky because these characters may not be valid identifiers in PHP. One way to handle this is to use the `xpath()` method to query the XML document and retrieve nodes based on their paths, which can include special characters. This allows you to access nodes without having to worry about the special characters causing issues.

$xml = <<<XML
<root>
    <node_with_@special_character>Value</node_with_@special_character>
</root>
XML;

$doc = new DOMDocument();
$doc->loadXML($xml);

$xpath = new DOMXPath($doc);
$nodes = $xpath->query('//node_with_@special_character');

foreach ($nodes as $node) {
    echo $node->nodeValue; // Output: Value
}