Re: XML to Array

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

 



On Sun, Mar 10, 2013 at 6:28 PM, Karl DeSaulniers <karl@xxxxxxxxxxxxxxx> wrote:
>
> On Mar 10, 2013, at 6:03 AM, richard gray wrote:
>
>> On 10/03/2013 11:47, Karl DeSaulniers wrote:
>>>
>>> Hi Guys,
>>> I am hoping someone can guide me or help me fix this issue.
>>> I have been lost in the code for some time now.
>>> I am trying to get the attributes of an xml node.
>>> I have this code:
>>> [snip]
>>
>> this may help ->
>> http://stackoverflow.com/questions/1156957/php-xml-attribute-parsing
>>>
>>> I do admit I haven't the foggiest idea what I am doing here, so I am
>>> noobing out here on how this php function is really working.
>>> I got it off php.net and am trying to implement it in my code. Without my
>>> addition it works well except it doesn't grab any attributes
>>> which I need in order for my script to work properly.
>>>
>>> Any ideas on what I am doing wrong?
>>>
>>> TIA,
>>
>>
>> HTH
>> rich
>
>
>
> Thanks rich,
> That uses simpleXML. I am using xml_parse_create.
> Any ideas for xml_parse_create? I really like the way this function
> puts everything into an array that I can traverse. I only need it to put
> the attribute values in the array for the corresponding node and I am done.
> *Sigh
>
> Thanks for your help,
>
> Best,
>
>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

I came across this XML to JSON to an array some time ago. It might be something

function xmlToArray($xml)
{
	return json_decode(json_encode((array) simplexml_load_string($xml)),1);
}

-- 

Bastien

Cat, the other other white meat

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[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