|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-11-11 13:13 UTC] chregu@php.net
[2003-11-11 13:14 UTC] chregu@php.net
[2003-11-25 01:54 UTC] megazone at cyphermint dot com
[2003-11-25 03:25 UTC] chregu@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
Description: ------------ I am opening an XML file and retrieving data using the get DomDocument->get_elements_by_tagname() function. This works on my Windows XP running 4.3.4 and it worked on the Unix system running 4.2.4 but when it was upgraded to 4.3.4 I can get simple tag names but not the child tags or attributes of a tag. From what I understand from the administrator, this was only an upgrade to PHP. Reproduce code: --------------- //---- statements that call function $courseDetails = domxml_open_file("quiz.xml"); $form->format = get_content($courseDetails,"questions/@TYPE"); $form->openyear = get_content($courseDetails,"timeopen/year"); //---- function called by statements above ---- function get_content($rootObject,$objectName){ if(!$objectList = $rootObject->get_elements_by_tagname($objectName)){ echo "error1"; return ""; } $firstChild = $objectList[0]->first_child(); if($firstChild->node_name() == "#text"){ $objectValue = $objectList[0]->get_content(); return $objectValue; } return ""; } //---- file this code is called on "quiz.xml" ----- <?xml version="1.0" encoding="iso-8859-1"?> <quiz> <timeopen> <year>2003</year> </timeopen> <questions TYPE="blackboard"> <file>res00001.dat</file> </questions> </quiz> Expected result: ---------------- should assign $form->format the value of "blackboard" and $form->openyear the value of "2003" Actual result: -------------- It will print "error1" for both and assign them the value of "".