[asterisk-commits] bkruse: branch group/appdocsxml r128563 - in /team/group/appdocsxml: ./ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 7 00:56:30 CDT 2008


Author: bkruse
Date: Mon Jul  7 00:56:27 2008
New Revision: 128563

URL: http://svn.digium.com/view/asterisk?view=rev&rev=128563
Log:
Updated the TODO list, ugh, still isn't working.

Have to revert tomorrow and find out what I b0rked.

Modified:
    team/group/appdocsxml/TODO_appdocsxml
    team/group/appdocsxml/main/pbx.c

Modified: team/group/appdocsxml/TODO_appdocsxml
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/TODO_appdocsxml?view=diff&rev=128563&r1=128562&r2=128563
==============================================================================
--- team/group/appdocsxml/TODO_appdocsxml (original)
+++ team/group/appdocsxml/TODO_appdocsxml Mon Jul  7 00:56:27 2008
@@ -11,15 +11,6 @@
 One end result usage would be to be able to verify dialplans
 based on arguments/results/types of dialplan applications,
 functions, and anything else that can be regulated to some degree.
-
-
-So far mvanbaak added an example in apps/app_dial.c of 
-an XML tree of the Dial application.
-
-(Added RetryDial as well)
-(Added MeetMe as well)
-
-Multiple Language Support :D
 
 **** Todo ****
 
@@ -45,7 +36,19 @@
 /var/lib/asterisk/documentation.xml
 
 
+Fix the XML parsing, it seems that is not returning the right
+XML blob. I will have to talk to russell....Adding the language
+finding support messed up the accuracy of the parsing.
+
 === DONE ===
 
 Change from iksemel to some other XML
 parsing library (libxml?)
+
+mvanbaak added an example in apps/app_dial.c of 
+an XML tree of the Dial application.
+
+(Added RetryDial as well)
+(Added MeetMe as well)
+
+Multiple Language Support :D

Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=128563&r1=128562&r2=128563
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Mon Jul  7 00:56:27 2008
@@ -337,7 +337,7 @@
 static unsigned int hashtab_hash_labels(const void *obj);
 static void __ast_internal_context_destroy( struct ast_context *con);
 #ifdef XML_DOCUMENTATION
-mxml_node_t *documentation_tree = NULL;
+mxml_node_t *documentation_tree = NULL, *docs = NULL;
 static char *ast_mxml_get_field(const char *type, const char *name, const char *var); 
 void _mxml_error(const char *cb);
 #endif
@@ -2627,33 +2627,35 @@
 	}
 
 	/* not fully initted yet */
-	if(documentation_tree == NULL) {
+	if(documentation_tree == NULL || docs == NULL) {
 		ast_log(LOG_DEBUG, "Parsing XML Tree Error\n");
 		return fail; 
 	}
 
-	node = mxmlFindElement(documentation_tree, documentation_tree, type, "name", name, MXML_DESCEND);
-
-	if (!node) {
+	ast_log(LOG_WARNING, "Searching For: name:'%s' type:'%s' var:'%s'\n", name, type, var);
+	//ret = mxmlFindElement(docs, docs, type, "name", name, MXML_DESCEND);
+	//ret = mxmlFindElement(documentation_tree, documentation_tree, "application", "name", "Dial", MXML_DESCEND);
+
+	if (!ret) {
 		ast_log(LOG_WARNING, "Cannot find Documentation name:'%s' type:'%s' var:'%s'\n", name, type, var);
 		return fail;
 	}
 
-	lang_node = mxmlFindElement(node, documentation_tree, type, "language", documentation_language, MXML_DESCEND);	
+//	lang_node = mxmlFindElement(node, documentation_tree, type, "language", documentation_language, MXML_DESCEND);	
 	
 	/* Could not find language, use the default one without a language */
-	if (!lang_node) {
-		ret = mxmlFindElement(node, documentation_tree, var, NULL, NULL, MXML_NO_DESCEND);
-	} else {
-		ret = mxmlFindElement(lang_node, documentation_tree, var, NULL, NULL, MXML_NO_DESCEND);
-	}
+//	if (!lang_node) {
+//		ret = mxmlFindElement(node, documentation_tree, var, NULL, NULL, MXML_NO_DESCEND);
+//	} else {
+//		ret = mxmlFindElement(lang_node, documentation_tree, var, NULL, NULL, MXML_NO_DESCEND);
+//	}
 
 	if (!ret || !ret->child) {
 		ast_log(LOG_WARNING, "Cannot find varible '%s' in tree '%s'\n", name, var);
 		return fail;
 	}
 
-	ast_log(LOG_ERROR, "a) '%s' \n\n b) '%s' \n\ntype: '%s', name:'%s', var:'%s'", ret->value.opaque, ret->child->value.opaque, type, name, var);
+	ast_log(LOG_ERROR, "a) '%s' b) '%s' type: '%s', name:'%s', var:'%s'\n", ret->value.opaque, ret->child->value.opaque, type, name, var);
 	/* Dont need fail anymore */
 	free(fail);
 	return ret->child->value.opaque;
@@ -4428,6 +4430,7 @@
 
 	if (!xmldoc) {
 		ast_log(LOG_ERROR, "Could not open XML Doc at '%s'\n", FILE_XML_DOC);
+		documentation_tree = NULL;
 		return 1;
 	}
 
@@ -4435,12 +4438,18 @@
 
 	if (!documentation_tree) {
 		ast_log(LOG_ERROR, "Parsing Problem with Documentation Tree\n");
+		documentation_tree = NULL;
+		return 1;
 	}
 
 	fclose(xmldoc);
 
-	/* Ok, let's now process it. */
-	/* Check for errors in loading the doc */
+	docs = mxmlFindElement(documentation_tree, documentation_tree, "docs", NULL, NULL, MXML_DESCEND);
+
+	if(!docs || !docs->child) {
+		ast_log(LOG_ERROR, "Could not find the docs element in the XML documentation.\n");
+		return 1;
+	}
 
 	return 0;
 }




More information about the asterisk-commits mailing list