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

Last change on this file since 4748 was 4748, checked in by Jean-Yves Lamoureux, 9 years ago
  • Added copyright notices
File size: 1.5 KB
Line 
1/*
2 *  Gaycko        Text mode web browser
3 *  Copyright (c) 2011 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  This library is free software. It comes without any warranty, to
7 *  the extent permitted by applicable law. You can redistribute it
8 *  and/or modify it under the terms of the Do What The Fuck You Want
9 *  To Public License, Version 2, as published by Sam Hocevar. See
10 *  http://sam.zoy.org/wtfpl/COPYING for more details.
11 */
12#ifndef _DOM_H
13#define _DOM_H
14
15#include <libxml/parser.h>
16#include <libxml/xinclude.h>
17#include <libxml/tree.h>
18#include <libxml/xmlIO.h>
19#include <libxml/HTMLparser.h>
20
21
22typedef enum  {
23    ELEM_UNKNOW = 0,
24    ELEM_TEXT,
25    ELEM_HTML,
26    ELEM_HEAD,
27    ELEM_TITLE,
28    ELEM_META,
29    ELEM_BODY,
30    ELEM_H1,
31    ELEM_BR,
32    ELEM_P,
33    ELEM_IMG,
34    ELEM_TABLE,
35    ELEM_TR,
36    ELEM_TD
37}nodeType;
38
39struct gAttribute_ {
40    char *name;
41    char *value;
42};
43typedef struct gAttribute_ gAttribute;
44
45typedef struct gNode_ gNode;
46struct gNode_ {
47    nodeType  type;
48        char        *name;
49    unsigned int level;
50   
51    unsigned int attribute_count;
52    gAttribute  *attributes;
53    char        *text;
54   
55    unsigned int children_count;
56    gNode   **children;
57   
58    gNode     *parent;
59};
60
61
62struct gDOM_ {
63        gNode *root;
64};
65
66typedef struct gDOM_ gDOM;
67
68
69gDOM *gaycko_convert_dom(htmlDocPtr doc);
70gNode* explore(gNode **elem, htmlNodePtr element, unsigned int level , gNode *parent);
71gNode *add_node(htmlNodePtr node);
72void destroy_node(gNode *elem);
73void pretty_print(gNode *elem);
74
75#endif
Note: See TracBrowser for help on using the repository browser.