|
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
[Back to original message]
|