";
while (list($key, $value) = each($attrs)) {
echo "$spacer....$key: $value
";
}
$depth[$parser]++;
}
// This function is called once for each ending
// XML tag.
function endElement($parser, $name) {
global $depth;
global $lst_current_tag;
$depth[$parser]--;
}
// This function is called for data contained
// within a tag. It is also called when whitespace
// is seen, which is why the data is trimmed and ignored
// if no characters are left.
function characterData($parser, $data) {
global $lst_current_tag;
$data = trim($data);
if (strlen($data)) {
print "$data
";
}
}
// Build up the URL to be fetched. You could also use
// a file from your local system. For example, you
// could use $url = '/usr/local/xml/harvey.xml';
$host = 'http://db.cis.upenn.edu/cgi-bin/serveXML?';
$service = 'SERVICE=IMDB';
$target = 'URL=http://us.imdb.com/Title?0042546';
$url = $host . $service . '&' . $target;
$data = read_file_into_buffer($url);
echo '