80 $this->success =
true;
83 $this->props = array();
86 $f_in = fopen(
$path,
"r");
88 $this->success =
false;
92 $xml_parser = xml_parser_create_ns(
"UTF-8",
" ");
94 xml_set_element_handler($xml_parser, array(&$this,
100 xml_set_character_data_handler($xml_parser, array(&$this,
104 xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING,
false);
106 while ($this->success && !feof($f_in)) {
107 $line = fgets($f_in);
108 if (is_string($line)) {
110 $this->success&= xml_parse($xml_parser, $line,
false);
115 $this->success&= xml_parse($xml_parser,
"",
true);
118 xml_parser_free($xml_parser);
133 if (strstr($name,
" ")) {
134 list($ns, $tag) = explode(
" ", $name);
135 if ($ns ==
"") $this->success =
false;
141 if ($this->depth == 1) {
145 if ($this->depth == 3) {
149 $this->current = array(
154 if ($this->mode ==
"set") {
155 $this->current[
"val"] =
"";
160 if ($this->depth >= 4) {
161 $this->current[
"val"].=
"<$tag";
163 foreach ($attr as $key => $val) {
164 $this->current[
"val"].=
' ' . $key .
'="' . str_replace(
'"',
'"', $val) .
'"';
167 $this->current[
"val"].=
">";
182 if (strstr($name,
" ")) {
183 list($ns, $tag) = explode(
" ", $name);
184 if ($ns ==
"") $this->success =
false;
192 if ($this->depth >= 4) {
193 $this->current[
"val"].=
"</$tag>";
196 if ($this->depth == 3) {
197 if (isset($this->current)) {
199 unset($this->current);
213 if (isset($this->current)) {
214 $this->current[
"val"].=
$data;
_endElement($parser, $name)
_startElement($parser, $name, $attrs)