source: gaycko/trunk/src/dom/dom.h @ 4744

Last change on this file since 4744 was 4744, checked in by Jean-Yves Lamoureux, 9 years ago
  • Changed gElement to gNode, elementType to nodeType
File size: 1.1 KB
Line 
1#ifndef _DOM_H
2#define _DOM_H
3
4#include <libxml/parser.h>
5#include <libxml/xinclude.h>
6#include <libxml/tree.h>
7#include <libxml/xmlIO.h>
8#include <libxml/HTMLparser.h>
9
10
11typedef enum  {
12    ELEM_UNKNOW = 0,
13    ELEM_TEXT,
14    ELEM_HTML,
15    ELEM_HEAD,
16    ELEM_TITLE,
17    ELEM_META,
18    ELEM_BODY,
19    ELEM_H1,
20    ELEM_BR,
21    ELEM_P,
22    ELEM_IMG,
23    ELEM_TABLE,
24    ELEM_TR,
25    ELEM_TD
26}nodeType;
27
28struct gAttribute_ {
29    char *name;
30    char *value;
31};
32typedef struct gAttribute_ gAttribute;
33
34typedef struct gNode_ gNode;
35struct gNode_ {
36    nodeType  type;
37        char        *name;
38    unsigned int level;
39   
40    unsigned int attribute_count;
41    gAttribute  *attributes;
42    char        *text;
43   
44    unsigned int children_count;
45    gNode   **children;
46   
47    gNode     *parent;
48};
49
50
51struct gDOM_ {
52        gNode *root;
53};
54
55typedef struct gDOM_ gDOM;
56
57
58gDOM *gaycko_convert_dom(htmlDocPtr doc);
59gNode* explore(gNode **elem, htmlNodePtr element, unsigned int level , gNode *parent);
60gNode *add_node(htmlNodePtr node);
61void destroy_node(gNode *elem);
62void pretty_print(gNode *elem);
63
64#endif
Note: See TracBrowser for help on using the repository browser.