function startElement($parser, $name, $attrs) { $this->stack = array(); $tag=array("name"=>$name,"attrs"=>$attrs); array_push($this->stack,$tag); } function dataElement($parser, $data) { if(trim($data)) { $this->stack[count($this->stack)-1]['data']=$data; } } function endElement($parser, $name) { $this->stack[count($this->stack)-2]['children'][] = $this->stack[count($this->stack)-1]; array_pop($this->stack); }
Wykorzystanie zmiennej $this->stack:
<?php for($j=0; $j<sizeof($this->stack[0][children][1][children]); $j++) { $a = $this->stack[0][children][1][children][$j][attrs][a]; $ab = $this->stack[0][children][1][children][$j][attrs][ab]; $zap = "SELECT COUNT(*) FROM test WHERE ab = '$ab'"; if($result[0] == 0) { $zapytanie = "INSERT INTO test (a_id, ab, a) VALUES (null, '$ab', '$a')"; $out = iconv("UTF-8","ISO-8859-2", $zapytanie); } else { } } ?>
Myślałem też o podziale pliku na kilka mniejszych jednak w tym przypadku nie specjalnie wiem jak sie za to zabrać.
Może wie ktoś w jaki sposób rozwiązać taki problem? Sugestie mile widziane.
Pozdr.