public static function parse_template($in_template) { JxBotAiml::$error = ''; JxBotAiml::$root = NULL; JxBotAiml::$stack = array(); $parser = JxBotAiml::parser_create('_template_open', '_template_close', '_template_data'); $in_template = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><template>" . $in_template . '</template>'; xml_parse($parser, $in_template, true); xml_parser_free($parser); return JxBotAiml::$root; }