You are here: Re: Newbie help with xml_parsed array « PHP Programming Language « IT news, forums, messages
Re: Newbie help with xml_parsed array

Posted by Nancy on 11/17/31 11:39

Thanks bob, this gave me the direction I needed to struggle through.
nan

"bobzimuta" <ejmalone@gmail.com> wrote in message
news:1139382691.349070.169960@g47g2000cwa.googlegroups.com...
>i was going to suggest a recursive way to build an array that is
> heriarchically correct, such as
>
> array( 'DATABPP' => array( 'COUNT' => 6692, 'PRICE' => 0, ... )
>
> but i'm guessing you want something more like
> $array( 'COUNT' => 6692, 'PRICE' => 0, .... );
>
> note that it's necessary to take account for multiple tags w/ same
> name, unless all the tags are unique. If you have two tags named
> 'price', you don't want to overwrite the first value with the second.
> But I'll leave that for you :)
>
> Please note this is pseudo (not tested) and I"m doing it before bed, so
> buyer beware.
>
> function build_xml( $node_array )
> {
> global $results;
> if( !$node_array[ 'children'] )
> {
> $results[ $node_array['name'] ] = $node_array[ 'tagData' ];
> }
> else
> {
> foreach( $node_array['children'] as $child )
> {
> build_xml( $child );
> }
> }
> }
>
> $results = array();
> build_xml( $some_root_array );
>
> Yes, it could be done by passing a reference to the function...
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация