1 /***************************************************************************
2 begin : Sat Feb 20 2010
3 copyright : (C) 2010 by Martin Preuss
4 email : martin@libchipcard.de
5
6 ***************************************************************************
7 * Please see toplevel file COPYING for license details *
8 ***************************************************************************/
9
10
11 #ifdef HAVE_CONFIG_H
12 # include <config.h>
13 #endif
14
15 #define DISABLE_DEBUGLOG
16
17 #include "g_generic_p.h"
18 #include "htmlctx_l.h"
19
20 #include <gwenhywfar/misc.h>
21 #include <gwenhywfar/debug.h>
22
23
24
25
HtmlGroup_Generic_new(const char * groupName,HTML_GROUP * parent,GWEN_XML_CONTEXT * ctx)26 HTML_GROUP *HtmlGroup_Generic_new(const char *groupName,
27 HTML_GROUP *parent,
28 GWEN_XML_CONTEXT *ctx)
29 {
30 HTML_GROUP *g;
31
32 /* create base group */
33 g=HtmlGroup_new(groupName, parent, ctx);
34 assert(g);
35
36 /* set virtual functions */
37 HtmlGroup_SetEndTagFn(g, HtmlGroup_Generic_EndTag);
38 HtmlGroup_SetAddDataFn(g, HtmlGroup_Generic_AddData);
39 HtmlGroup_SetEndSubGroupFn(g, HtmlGroup_Generic_EndSubGroup);
40
41 return g;
42 }
43
44
45
HtmlGroup_Generic_EndTag(HTML_GROUP * g,const char * tagName)46 int HtmlGroup_Generic_EndTag(HTML_GROUP *g, const char *tagName)
47 {
48 assert(g);
49
50 if (strcasecmp(HtmlGroup_GetGroupName(g), tagName)!=0) {
51 DBG_INFO(GWEN_LOGDOMAIN,
52 "Tag [%s] does not close [%s], ignoring",
53 tagName, HtmlGroup_GetGroupName(g));
54 /*return GWEN_ERROR_BAD_DATA;*/
55 return 0;
56 }
57
58 /* always end this tag */
59 return 1;
60 }
61
62
63
HtmlGroup_Generic_AddData(HTML_GROUP * g,GWEN_UNUSED const char * data)64 int HtmlGroup_Generic_AddData(HTML_GROUP *g, GWEN_UNUSED const char *data)
65 {
66 assert(g);
67
68 /* just ignore the data */
69 return 0;
70 }
71
72
73
HtmlGroup_Generic_EndSubGroup(HTML_GROUP * g,GWEN_UNUSED HTML_GROUP * sg)74 int HtmlGroup_Generic_EndSubGroup(HTML_GROUP *g, GWEN_UNUSED HTML_GROUP *sg)
75 {
76 assert(g);
77
78 /* just ignore the end of sub group */
79 return 0;
80 }
81
82
83
84
85
86
87
88
89
90
91
92