function ARC_erdf_parser::handle_open in Taxonomy import/export via XML 5
Same name and namespace in other branches
- 5.2 arc/ARC_erdf_parser.php \ARC_erdf_parser::handle_open()
- 6.2 arc/ARC_erdf_parser.php \ARC_erdf_parser::handle_open()
- 6 arc/ARC_erdf_parser.php \ARC_erdf_parser::handle_open()
1 call to ARC_erdf_parser::handle_open()
File
- arc/
ARC_erdf_parser.php, line 363
Class
Code
function handle_open($parser, $tag, $attrs) {
/* erdf check */
if (isset($attrs["profile"]) && strpos($attrs["profile"], "http://purl.org/NET/erdf/profile") !== false) {
$this->is_erdf = true;
}
/* base check */
if ($tag == "base" && isset($attrs["href"])) {
$this
->set_base($attrs["href"]);
}
/* href, src, id */
if (isset($attrs["href"])) {
$attrs["full_href"] = $this
->calc_abs_iri($attrs["href"]);
}
if (isset($attrs["src"])) {
$attrs["full_src"] = $this
->calc_abs_iri($attrs["src"]);
}
if (isset($attrs["id"])) {
$attrs["full_id"] = $this
->calc_abs_iri("#" . $attrs["id"]);
}
/* node */
$node = array(
"tag" => $tag,
"attrs" => $attrs,
"subj" => $this->subj_count ? $this
->get_cur_subj() : $this->base,
"level" => $this->level,
"pos" => 0,
"p_id" => $this->node_count - 1,
"state" => "open",
"cdata" => "",
);
/* parent */
if ($this->node_count) {
$prev_node = $this
->get_cur_node();
if ($prev_node["level"] == $this->level) {
$node["p_id"] = $prev_node["p_id"];
$node["pos"] = $prev_node["pos"] + 1;
}
elseif ($prev_node["level"] > $this->level) {
while ($prev_node["level"] > $this->level) {
$prev_node = $this->nodes[$prev_node["p_id"]];
}
$node["p_id"] = $prev_node["p_id"];
$node["pos"] = $prev_node["pos"] + 1;
}
}
$this
->push_node($node);
$this->level++;
/* subj */
$subj = $node["subj"];
if (isset($attrs["href"])) {
$subj = $attrs["full_href"];
}
elseif (isset($attrs["id"])) {
$subj = $this
->calc_abs_iri("#" . $attrs["id"]);
}
$this
->push_subj($subj);
/* cdata */
$this->cur_cdata = "";
}