Results 1 to 2 of 2

Thread: SimpleXML Load File -

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2008
    Posts
    7

    SimpleXML Load File -

    I'm trying to parse a XML file, here is the var dump of the structure:

    Code:
    object(SimpleXMLElement)[1]
      public '@attributes' => 
        array (size=1)
          'version' => string '2' (length=1)
      public 'currentTime' => string '2014-08-24 22:27:33' (length=19)
      public 'result' => 
        object(SimpleXMLElement)[2]
          public 'rowset' => 
            object(SimpleXMLElement)[3]
              public '@attributes' => 
                array (size=3)
                  ...  public 'cachedUntil' => string '2014-08-24 22:27:33' (length=19)
              public 'row' => 
                array (size=398)
                  ...
    There are 398 rows returned that I need to display. If I use:
    PHP Code:
    echo $listInfo->result->rowset->row[0]['jobID']."<br />"
    It works fine, but as soon as I introduce a Foreach loop, and remove the [0] I get issues. I will either get an error saying its not an Object or I'll just get the first row returned and nothing else.

  2. #2

    Thread Starter
    New Member
    Join Date
    Sep 2008
    Posts
    7

    Re: SimpleXML Load File -

    Think I got it, I used a for loop instead of foreach and just incremented the array value.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width