448191 Posted August 20, 2006 Share Posted August 20, 2006 Argh.[quote]Fatal error: Uncaught exception 'Exception' with message 'Node not found.' in E:\John\Sites\CurrentDev\johnkleijn.nl\lib\domxml.class.php:45 Stack trace: #0 E:\John\Sites\CurrentDev\johnkleijn.nl\lib\env.class.php(83): DomXml->getElementById('log_errors') #1 E:\John\Sites\CurrentDev\johnkleijn.nl\lib\backbone.class.php(27): Env->get('log_errors') #2 E:\John\Sites\CurrentDev\johnkleijn.nl\index2.php(6): Backbone->__construct('transitional', 'iso-8859-1') #3 {main} thrown in E:\John\Sites\CurrentDev\johnkleijn.nl\lib\domxml.class.php on line 45[/quote]As you can see by looking at the backtrace, the exeption is thrown from DomXml->getElementById.[b]DomXml->getElementById('log_errors')[/b][code]<?php public function getElementById($id) { if($this->domDoc->validate()) { if(!$node = $this->domDoc->getElementById($id)) { throw new Exception('Node not found.'); } else { return $node; } } else { return false; } }?>[/code]While:[code]<error_flag id="log_errors">true</error_flag>[/code]and the attribute id is specified to be of type ID:[code]<!ENTITY % idattr "id ID #IMPLIED" ><!ELEMENT error_flag (#PCDATA)> <!ATTLIST error_flag %idattr; >[/code] Obviously, the XML file validates, or the exeption could never have been thrown. I just don't get why I don't get the freakin node to return! Quote Link to comment Share on other sites More sharing options...
448191 Posted August 20, 2006 Author Share Posted August 20, 2006 What the $#!@^&%? is going on?I messed up the DTD intentionally to see what would happen:[code]<!-- <!ELEMENT error_flag (#PCDATA)> --><!ATTLIST error_flag id ID #REQUIRED > [/code]When tested with Dreamweavers validation it retruns the correct error: "unknown element error_flag" (before it didn't return anything), but when I try to run the test script, I get NO validation errors, just the same exeption! That doesn't make any sense! Quote Link to comment Share on other sites More sharing options...
448191 Posted August 20, 2006 Author Share Posted August 20, 2006 Never mind, I'm an idiot. ;DIn Env::__construct() I forget to load the XML file, so I was trying to get nodes out of an empty document... ::) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.