hit = true; } else { $this->hit = false; } } if ($this->hit && $elementname == "title") { $this->titleHit = true; } else { $this->titleHit =false; } } //callback for end Element function endElement($parser_object, $elementname) { } function contentHandler($parser_object,$data) { if ($this->titleHit) { print trim($data); if ($GLOBALS['argv'][1] == "firstonly") { memReport(); exit(); } } } } doParse($parser_object); memReport(); function doParse($parser_object) { //open a filehandle to books.xml if (!($fp = fopen("planet-big.xml", "r"))); //loop through data while ($daten = fread($fp, 4096)) { //parse the fragment xml_parse($parser_object, $daten, feof($fp)); } }