Using variable for tag in getElementsByTagName() for PHP and XML?
- by Jared
See my PHP:
$file = "routingConfig.xml";
global $doc;
$doc = new DOMDocument();
$doc->load( $file );
$ElTag = "Route";
$tag = $doc->getElementsByTagName($ElTag);
XML is:
<Routes>
<Route></Route>
<Route></Route>
<Routes>
Error returned is:
Fatal error: Call to a member function getElementsByTagName() on a non-object
I'm not sure how to do this?