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

Brian May
Project Lead
Management Information Systems
Garan, Incorporated
Starkville, Mississippi

Young i Professionals

"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>

"'Web Enabling the AS400 / iSeries'" <web400@xxxxxxxxxxxx>

[WEB400] Getting XML child Elements PHP


I have an XML file I need to parse using PHP, and for the most part, I
parse it fine.

So if I have something like this, it works fine, no problems:

$mydata = simplexml_load_file($FileToOpen);









And I can get the data using something like this:

$LastName = $mydata->batch->Report->

$FirstName =

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
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

Shannon O'Donnell

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].