You are here: Re: Parsing XML Tags Help « PHP Programming Language « IT news, forums, messages
Re: Parsing XML Tags Help

Posted by NC on 10/10/05 21:35

ralphNOSPAM@primemail.com wrote:
>
> > > in the XML tag below, I want to pull out 'CALIFORNIA'.
> > >
> > > <txtNameUSState>CALIFORNIA</txtNameUSState>
>
> There are multiple tags I need to strip out of the xml image so your
> $state = example wouldn't work.

Well, then you need to use an XML extension of some sort. Let's say
your XML is stored at http://www.example.com/file.xml. Then you can
try something like this:

$content = file_get_contents('http://www.example.com/file.xml');
$p = xml_parser_create();
xml_parse_into_struct($p, $content, $vals, $index);
xml_parser_free($p);
unset($content);
foreach ($index['txtNameUSState'] as $key => $id) {
$value = $vals[$id]['value'];
// now $value contains the text inside <txtNameUSState> tags
}

Cheers,
NC

 

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

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