jd2007 Posted December 17, 2007 Share Posted December 17, 2007 php code : <?php $doc = new DomDocument; // We need to validate our document before refering to the id $doc->validateOnParse = true; $doc->Load('xml.php'); echo $doc->getElementById('477b0f0cdd410')->tagName . "\n"; ?> this is xml.php: <?xml version="1.0" encoding="windows-1250"?> <sos><cat id3="477b0f0cdd410"/></sos> Link to comment https://forums.phpfreaks.com/topic/82019-solved-i-have-a-problem-with-getelementbyid-its-returning-nothingwhy/ Share on other sites More sharing options...
trq Posted December 17, 2007 Share Posted December 17, 2007 Shouldn't it be <cat id= and not <cat id3= ? Link to comment https://forums.phpfreaks.com/topic/82019-solved-i-have-a-problem-with-getelementbyid-its-returning-nothingwhy/#findComment-416767 Share on other sites More sharing options...
jd2007 Posted December 17, 2007 Author Share Posted December 17, 2007 when i set it i gave it the name 'id3' and set id3's type to ID.... Link to comment https://forums.phpfreaks.com/topic/82019-solved-i-have-a-problem-with-getelementbyid-its-returning-nothingwhy/#findComment-416768 Share on other sites More sharing options...
freebsdntu Posted December 17, 2007 Share Posted December 17, 2007 $doc->Load('xml.php'); I am not sure if you can load a .php file. Link to comment https://forums.phpfreaks.com/topic/82019-solved-i-have-a-problem-with-getelementbyid-its-returning-nothingwhy/#findComment-416771 Share on other sites More sharing options...
jd2007 Posted December 18, 2007 Author Share Posted December 18, 2007 oh...its actually .xml, I accidentally typed it wrong...i still have the problem.. Link to comment https://forums.phpfreaks.com/topic/82019-solved-i-have-a-problem-with-getelementbyid-its-returning-nothingwhy/#findComment-417324 Share on other sites More sharing options...
jd2007 Posted December 18, 2007 Author Share Posted December 18, 2007 never mind, i fixed it...anyway thanks for ur answers... Link to comment https://forums.phpfreaks.com/topic/82019-solved-i-have-a-problem-with-getelementbyid-its-returning-nothingwhy/#findComment-417335 Share on other sites More sharing options...
play_ Posted December 18, 2007 Share Posted December 18, 2007 What was the solution? Link to comment https://forums.phpfreaks.com/topic/82019-solved-i-have-a-problem-with-getelementbyid-its-returning-nothingwhy/#findComment-417345 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.