00001
00012 #include <expat.h>
00013
00014
00015 #define SZ_ATTRNAME 32
00016 #define SZ_FNAME 255
00017 #define SZ_XMLTAG 255
00018 #define SZ_LINE 4096
00020 #define MAX_ATTR 100
00021 #define HANDLE_INCREMENT 8000
00023 #ifndef OK
00024 #define OK 0
00025 #endif
00026 #ifndef ERR
00027 #define ERR 1
00028 #endif
00029
00030
00034 #ifndef handle_t
00035 #define handle_t int
00036 #endif
00037
00038
00039
00047 typedef struct {
00048 char name[SZ_ATTRNAME];
00049 char value[SZ_ATTRNAME];
00050 void *next;
00051 } AttrList;
00052
00053
00061 typedef struct {
00062 char *req;
00063 char *opt;
00064 void *attributes;
00065 } AttrBlock;
00066
00067
00073 typedef struct elem_t {
00074 unsigned int type;
00075 AttrBlock *attr;
00076 char *content;
00078 struct elem_t *next;
00079 struct elem_t *last_child;
00080 struct elem_t *child;
00081 struct elem_t *parent;
00083 char **data;
00085 unsigned char ref_count;
00086 } Element;
00087
00088
00093 typedef struct node {
00094 Element *element;
00095 void *next;
00096 } Node;
00097
00098
00103 typedef struct {
00104 Node *head;
00105 int level;
00106 } Stack;
00107
00108
00109
00117
00118
00119 int vot_attrSet (AttrBlock *ablock, char *name, char *value);
00120 char *vot_attrGet (AttrBlock *ablock, char *name);
00121 char *vot_attrXML (AttrBlock *ablock);
00122
00123
00124
00125 int vot_eType (char *name);
00126 char *vot_elemName (Element *e);
00127 int vot_elemType (Element *e);
00128 char *vot_elemXML (Element *e);
00129 char *vot_elemXMLEnd (Element *e);
00130 Element *vot_newElem (unsigned int type);
00131
00132
00133
00134 handle_t vot_setHandle (Element *elem);
00135 handle_t vot_lookupHandle (Element *elem);
00136 void vot_freeHandle (handle_t handle);
00137 Element *vot_getElement (handle_t handle);
00138 void vot_newHandleTable (void);
00139 int vot_handleCount (void);
00140 void vot_handleCleanup (void);
00141
00142
00143
00144 void vot_endElement (void *userData, const char *name);
00145 void vot_startElement (void *userData, const char *name, const char **atts);
00146 void vot_charData (void *userData, const XML_Char *s, int len);
00147
00148
00149
00150 void votPush (Stack *st, Element *elem);
00151 Element *votPop (Stack *st);
00152 Element *votPeek (Stack *st);
00153
00154 Stack *vot_newStack (void);
00155 int vot_isEmpty (Stack *st);
00156 void vot_clearStack (Stack *st);
00157 void vot_printStack (Stack *st);