function ARC_rdfxml_parser::parse_file in Taxonomy import/export via XML 6.2
Same name and namespace in other branches
- 5.2 arc/ARC_rdfxml_parser.php \ARC_rdfxml_parser::parse_file()
- 5 arc/ARC_rdfxml_parser.php \ARC_rdfxml_parser::parse_file()
- 6 arc/ARC_rdfxml_parser.php \ARC_rdfxml_parser::parse_file()
File
- arc/
ARC_rdfxml_parser.php, line 960
Class
Code
function parse_file($path) {
if ($fp = fopen($path, "r")) {
if (!$this->init_args["base"]) {
$this->init_args["base"] = $path;
}
$this
->init(false);
$this->encoding = $this->encoding == "auto" ? "UTF-8" : $this->encoding;
$this
->create_parser();
while ($data = fread($fp, 4096)) {
if ($this->save_data) {
$this->data .= $data;
}
if (!($success = xml_parse($this->parser, $data, feof($fp)))) {
$error_str = xml_error_string(xml_get_error_code($this->parser));
$line = xml_get_current_line_number($this->parser);
fclose($fp);
xml_parser_free($this->parser);
return "XML error: '" . $error_str . "' at line " . $line . "\n";
}
}
$this->target_encoding = xml_parser_get_option($this->parser, XML_OPTION_TARGET_ENCODING);
xml_parser_free($this->parser);
fclose($fp);
$this
->done();
}
return $this->triples;
}