Re: [PHP] XML to Array

[email protected] (Bastien Koert)
Newsgroups php.general
Message-ID <CAHxaJ1Xx3L-Y3vZA2VjL23TtHnA0PWD_Q9NU5nqqUNcrMqsEUw@mail.gmail.com>
On Sun, Mar 10, 2013 at 6:28 PM, Karl DeSaulniers <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.