function import_xml($xmldata) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, $xmldata, $vals, $index); xml_parser_free($parser); unset($index); $node = new xmltool('node', $vals[0]['tag'], $this->indentstring); if (isset($vals[0]['attributes'])) { while (list($key, $value) = each($vals[0]['attributes'])) { $node->set_attribute($key, $value); } } switch ($vals[0]['type']) { case 'complete': $node->set_value($vals[0]['value']); break; case 'cdata': $node->set_value($vals[0]['value']); break; case 'open': $node = $this->import_xml_children($vals, $i = 0, $node); break; case 'closed': exit; } $this->add_node($node); }