Hi,
The following script parses some XML to try and get the value of ID. Is there a better way of doing this ?
<?
$simple = "<QueryResult><Count>2428</Count><DispMax>1</DispMax><DispStart>0</DispStart><Id>10754179</Id>";
$simple .= "<TranslationSet></TranslationSet><TranslationStack><TermSet><Term>\"breasts\"</Term>";
$simple .= "<Field>All Fields</Field><Count>2428</Count><Explode>Y</Explode></TermSet></TranslationStack></QueryResult>";
$p = xml_parser_create();
xml_parse_into_struct($p,$simple,&$vals,&$index);
xml_parser_free($p);
while ( list ( $keys, $values ) = each ($index)) {
if ($keys == "ID") {
list ( $key ) = $values;
while ( list ( $key1, $value1 ) = each ($vals[$key])) {
if ($key1 == "value") $cutstring = $value1;
}
}
}
echo "cs = $cutstring";