I have a working XML parser and now want to print some of the attributes,
I want to pull into an array the type and qualifier" attributes from "Screening":
<Screening type="developer" qualifier="home">
the how can I do that ?
Here is a piece of my XML doc:
<Screenings>
<Screening type="developer" qualifier="home">
<ScreeningResults type="result" mediaType="structured" resultType="report">
<Status>YES RECORD</Status>
<Region>NC</Region>
<County>UNION</County>
Here is a piece of my parser:
function parse() {
$this->output['Message'] = '';
foreach ($this->data as $k=>$v) {
switch ($v['type']) {
case 'open': // startup a handler or whatever
if (!empty($this->handlers[$v['tag']])) {
$this->tagdata[0] = $v['tag'];
$this->tagdata[$v['tag']]++;
$this->output[$this->handlers[$v['tag']][1]][$this->tagdata[$v['tag']]] = array();
}
break;
case 'close': // close handler, call handler func if defined
if (!empty($this->handlers[$v['tag']])) {
$td = $this->tagdata[$v['tag']];
$arr = $this->output[$this->handlers[$v['tag']][1]][$this->tagdata[$v['tag']]];
$this->output[$this->handlers[$v['tag']][1]][$this->tagdata[$v['tag']]][0] = call_user_func($this->handlers[$v['tag']][0],$arr);
$this->tagdata[0] = '';
}
break;
case 'complete': // usually for actual data
if ($v['tag']=='Status') {
$this->output['Status']= $v['value'];
} else if (empty($this->tagdata[0])) {
$this->output[$v['tag']] = $v['value'];
}
if (empty($this->tagdata[0])) {
$this->output[$v['tag']] = $v['value'];
}
break;
default:
break;
}
}
}
Appreciate the help !