Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
02-07-2013, 08:35 PM #1
- Join Date
- May 2008
- Thanked 5 Times in 5 Posts
simpleXML loop missing first and last node
I am running a foreach loop that goes through a standard array of string values. These values are used to search xml nodes with simpleXML and get the matching node for processing.
For the most part my loop is a success. Only the first and last nodes being searched from the array are not getting found. I know that it is strictly the first and last values of the array for that by trading values in the array will cause the value that wasnt last or first but found before is now not being found when put first or last in the array.
Here is my code:
$inputArr = explode(',',$requiredNode);
$customerNode = $apiXML->customer;
foreach($inputArr as $input)
echo 'input: '.$input.'<br />';
$childNode = $customerNode->$input;
echo 'child: '.$childNode.'<br />';
$nodeArr = array($childNode->getName(), $childNode, $childNode['value'], $childNode['readonly']);
$input - is getting all the info I expect when running an echo
$childNode - works fine except the first and last index in the loop, it returns empty in those cases (the values being search are in the xml file, I made sure of that and it can be found when not in the first or last index of $inputArr)
Appreciate any help with this
02-09-2013, 11:29 PM #2
- Join Date
- Jan 2011
- Thanked 792 Times in 790 Posts
Is there anyway you can post the xml or if huge a part of it?