I’m trying to use the XML DOM in CodeIgniter, but I can’t load the xml document. I’m not sure I understand CodeIgniter well enough yet, but I guess there’s some problem with how I write the path to the file:
$xmlDoc = new DOMDocument();
$xmlDoc->load('filter.xml');
The file is located in the same directory as the calling file. But this doesn’t work. I have also tried variations of the path like this:
‘/application/models/filter.xml’
base_url().’/application/models/filter.xml’
base_url().’application/models/filter.xml’
But nothing works. Could someone please explain how these relative paths should work, and what I need to do instead to be able to load the xml document?
use realpath to debug and understand where CodeIgniter tries to find your file.