What are some potential pitfalls when using SimpleXML in PHP for parsing XML files?

One potential pitfall when using SimpleXML in PHP for parsing XML files is that it may not handle large XML files efficiently, leading to performance issues. To mitigate this, consider using alternative XML parsing libraries such as XMLReader for better performance with large files.

// Example of using XMLReader instead of SimpleXML for parsing large XML files
$xml = new XMLReader();
$xml->open('large_file.xml');

while($xml->read()) {
    // Parse XML here
}

$xml->close();