That was it!
Thanks very much!
-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of BMay@xxxxxxxxx
Sent: Wednesday, December 09, 2009 9:54 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Getting XML child Elements PHP
Shannon,
I think you need to use:
$caseID = $mydata->batch->Report['caseID'];
I'm not where I can test it, but I think that is the syntax for retrieving 
attributes.
Brian May
Project Lead
Management Information Systems
Garan, Incorporated
Starkville, Mississippi
Young i Professionals
http://www.youngiprofessionals.com
"Shannon ODonnell" <sodonnell@xxxxxxxxxxxxxxxxxxxxxxxxx> 
Sent by: web400-bounces@xxxxxxxxxxxx
12/09/2009 09:44 AM
Please respond to
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>
To
"'Web Enabling the AS400 / iSeries'" <web400@xxxxxxxxxxxx>
cc
Subject
[WEB400] Getting XML child Elements PHP
Hi,
 
I have an XML file I need to parse using PHP,  and for the most part, I 
can
parse it fine.
 
So if I have something like this, it works fine, no problems:
 
 
$mydata =  simplexml_load_file($FileToOpen);
 
<batch>
  <Report>
   <Page1>
     <violator_last_name>ZAMBRANO</violator_last_name>
     <violator_first_name>FRANK</violator_first_name>
  </Page1>
 </report>
</batch>
 
And I can get the data using something like this:
 
$LastName             = $mydata->batch->Report-> 
Page1->violator_last_name;
$FirstName             = 
$mydata->batch->Report->Page1->violator_first_name;
 
 
 
However, at the start of certain blocks of data, I have lines like this:
 
<Report caseID="122" number="000900006S">
 
The element is <Report>  but as you can see, it has child elements of 
caseID
and number.
 
I cannot figure out how to get the values of those child elements.
 
This does NOT work:
 
$caseID             = $mydata->batch->Report-> caseID;
 
I have Googled this and looked around but I can't find a solution that
works.
 
 
Shannon O'Donnell
As an Amazon Associate we earn from qualifying purchases.