SimpleXMLElement Question.

    Date: 04/29/07 (PHP Development)    Keywords: xml, web

    I am connecting to Amazon's S3 web service. I've created 2 buckets, and am now writing a function to get back the list of buckets from S3, and am having problems parsing the XML with simple XML.

    I've got down to the bucket Node in a foreach loop as $bucketObj in the XML this Node had "Name" and "CreationDate" as XML nodes.

    $bucketObj->Name;
    $bucketObj->CreationDate;

    The problem is when I call them instead of getting a "string" variable, I have a "SimpleXMLElement" If I var dump Name it looks like

        object(SimpleXMLElement)#17 (1) {
          [0]=>
          string(13) "JamesTest1234"
        }
    


    How do I get access to [0] I've tried all kinds of things. If it was ['0'] I'd know how to get it, but in this case when I try $bucketObj->Name->0 it fails I've also tried $bucketObj->Name[0].

    I'm really confused. I've used SimpleXML before and hadn't had any kinds of issues like this, so any suggestions would be greatly appreaciated.

    This is the XML I receive with a little modified info:
    
    
        
            amazon key data
            amazon
        
        
            
                JamesTest1234
                2007-04-29T01:08:47.000Z
            
            
                JamesTest12345
                2007-04-29T01:10:47.000Z
            
        
    
    

    Source: http://php-dev.livejournal.com/76895.html

« phpAPP: Include file to... || Writing a SOAP server »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home