Re: SimpleXML and the Single String (SOLVED)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Jay

If you're not using the variable *$xmlCompany* somewhere else I'd try to
skip the array and just do it with this single line:
*$arrayLead[0]->Company = (string)
$xml->SignonRq->SignonTransport->CustId->SPName;*

The result should not differ from what you have now.

Bye
Simon

2012/2/21 Jay Blanchard <jay.blanchard@xxxxxxxxxxxxxxxxxxx>

> Howdy,
>
> My PHP chops are a little rough around the edges so I know that I am
> missing something. I am working with SimpleXML to retrieve values from an
> XML file like this -
>
> $xmlCompany = $xml->SignonRq->SignonTransport->CustId->SPName;
>
> If I echo $xmlCompany I get the proper information.
>
> If I use $xmlCompany as an array value though, I get this object -
>
> $arrayLead[0]->Company = $xmlCompany; // what I did
> [Company] => SimpleXMLElement Object // what I got
>                (
>                    [0] => Dadgummit
>                )
> I tried casting AND THEN AS I TYPED THIS I figured it out...
>
> $xmlCompany = array((string)
> $xml->SignonRq->SignonTransport->CustId->SPName); // becomes an array
> $arrayLead[0]->Company = $xmlCompany[0]; // gets the right bit of the array
>
> and the result is
>
>  [Company] => Dadgummit
> Thanks for bearing with me!
>
>
>
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux