Author: ArcRiley Date: 2009-01-06 14:01:34 -0500 (Tue, 06 Jan 2009) New Revision: 1429
Modified: trunk/concordance/src/Core.c Log: Added character data callback for username processing Modified: trunk/concordance/src/Core.c =================================================================== --- trunk/concordance/src/Core.c 2009-01-06 18:42:49 UTC (rev 1428) +++ trunk/concordance/src/Core.c 2009-01-06 19:01:34 UTC (rev 1429) @@ -28,7 +28,8 @@ static gboolean conCore_sessionData (GIOChannel*, GIOCondition, gpointer); static void conCore_xmlStart (gpointer, const XML_Char*, const XML_Char**); -static void conCore_xmlEnd (gpointer, const XML_Char *name); +static void conCore_xmlEnd (gpointer, const XML_Char*); +static void conCore_xmlCharData (gpointer, const XML_Char*, gint); /*\ cdef class Core : \*/ @@ -386,12 +387,17 @@ void XML_SetElementHandler (XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); + void XML_SetCharacterDataHandler + (XML_Parser parser, + XML_CharacterDataHandler handler); + */ newSession->pars = XML_ParserCreate(NULL); XML_SetUserData(newSession->pars, newSession); XML_SetElementHandler(newSession->pars, conCore_xmlStart, conCore_xmlEnd); + XML_SetCharacterDataHandler(newSession->pars, conCore_xmlCharData); + - /* add new channel to the channels hashtable void g_hash_table_insert (GHashTable *hash_table, @@ -477,7 +483,7 @@ cdef : \*/ conSession* session = (conSession*) s; conCoreObject* self = session->core; - gint i; /* temporary*/ + gint i; /* this from http://www.xml.com/pub/a/1999/09/expat/index.html?page=2 */ for (i = 0; i < session->depth; i++) @@ -513,7 +519,7 @@ cdef : \*/ conSession* session = (conSession*) s; conCoreObject* self = session->core; - gint i; /* temporary*/ + gint i; session->depth--; for (i = 0; i < session->depth; i++) @@ -522,6 +528,22 @@ } + static void + conCore_xmlCharData(gpointer s, const XML_Char* str, gint str_len) { /*\ + cdef : \*/ + conSession* session = (conSession*) s; + conCoreObject* self = session->core; + gint i; + gchar* strn; + + strn = g_strndup(str, str_len); + for (i = 0; i < session->depth; i++) + printf(" "); + printf("%s\n", strn); + g_free(strn); + } + + static PyMethodDef conCore_methods[] = { { NULL, NULL }, }; _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn