81 $this->success =
true;
84 $this->props = array();
87 $f_in = fopen(
$path,
"r");
89 $this->success =
false;
93 $xml_parser = xml_parser_create_ns(
"UTF-8",
" ");
95 xml_set_element_handler($xml_parser, array(&$this,
101 xml_set_character_data_handler($xml_parser, array(&$this,
105 xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING,
false);
107 while ($this->success && !feof($f_in)) {
108 $line = fgets($f_in);
109 if (is_string(
$line)) {
111 $this->success&= xml_parse($xml_parser,
$line,
false);
116 $this->success&= xml_parse($xml_parser,
"",
true);
119 xml_parser_free($xml_parser);
134 if (strstr(
$name,
" ")) {
135 list($ns, $tag) = explode(
" ",
$name);
136 if ($ns ==
"") $this->success =
false;
142 if ($this->depth == 1) {
146 if ($this->depth == 3) {
150 $this->current = array(
155 if ($this->mode ==
"set") {
156 $this->current[
"val"] =
"";
161 if ($this->depth >= 4) {
162 $this->current[
"val"].=
"<$tag";
164 foreach ($attr as $key => $val) {
165 $this->current[
"val"].=
' ' . $key .
'="' . str_replace(
'"',
'"', $val) .
'"';
168 $this->current[
"val"].=
">";
183 if (strstr(
$name,
" ")) {
184 list($ns, $tag) = explode(
" ",
$name);
185 if ($ns ==
"") $this->success =
false;
193 if ($this->depth >= 4) {
194 $this->current[
"val"].=
"</$tag>";
197 if ($this->depth == 3) {
198 if (isset($this->current)) {
200 unset($this->current);
214 if (isset($this->current)) {
215 $this->current[
"val"].= $data;