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,
95 array(&$this,
"_startElement"),
96 array(&$this,
"_endElement"));
98 xml_set_character_data_handler($xml_parser,
99 array(&$this,
"_data"));
101 xml_parser_set_option($xml_parser,
102 XML_OPTION_CASE_FOLDING,
false);
104 while($this->success && !feof($f_in)) {
105 $line = fgets($f_in);
106 if (is_string($line)) {
108 $this->success &= xml_parse($xml_parser, $line,
false);
113 $this->success &= xml_parse($xml_parser,
"",
true);
116 xml_parser_free($xml_parser);
132 if (strstr($name,
" ")) {
133 list($ns, $tag) = explode(
" ", $name);
135 $this->success =
false;
141 if ($this->depth == 1) {
145 if ($this->depth == 3) {
146 $prop = array(
"name" => $tag);
147 $this->current = array(
"name" => $tag,
"ns" => $ns,
"status"=> 200);
148 if ($this->mode ==
"set") {
149 $this->current[
"val"] =
"";
153 if ($this->depth >= 4) {
154 $this->current[
"val"] .=
"<$tag";
155 foreach ($attr as $key => $val) {
156 $this->current[
"val"] .=
' '.$key.
'="'.str_replace(
'"',
'"', $val).
'"';
158 $this->current[
"val"] .=
">";
176 if (strstr($name,
" ")) {
177 list($ns, $tag) = explode(
" ", $name);
179 $this->success =
false;
187 if ($this->depth >= 4) {
188 $this->current[
"val"] .=
"</$tag>";
191 if ($this->depth == 3) {
192 if (isset($this->current)) {
194 unset($this->current);
208 if (isset($this->current)) {
209 $this->current[
"val"] .=
$data;