1 | /** |
---|
2 | * |
---|
3 | * @file xparser.h |
---|
4 | * @author Aleix Conchillo Flaque <aleix@member.fsf.org> |
---|
5 | * @date Mon Nov 25, 2002 00:57 |
---|
6 | * @brief SCEW private parser type declaration |
---|
7 | * |
---|
8 | * $Id: xparser.h,v 1.2 2004/05/25 20:23:05 aleix Exp $ |
---|
9 | * |
---|
10 | * @if copyright |
---|
11 | * |
---|
12 | * Copyright (C) 2002, 2003, 2004 Aleix Conchillo Flaque |
---|
13 | * |
---|
14 | * SCEW is free software; you can redistribute it and/or |
---|
15 | * modify it under the terms of the GNU Lesser General Public |
---|
16 | * License as published by the Free Software Foundation; either |
---|
17 | * version 2.1 of the License, or (at your option) any later version. |
---|
18 | * |
---|
19 | * SCEW is distributed in the hope that it will be useful, |
---|
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
22 | * Lesser General Public License for more details. |
---|
23 | * |
---|
24 | * You should have received a copy of the GNU Lesser General Public |
---|
25 | * License along with this library; if not, write to the Free Software |
---|
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
---|
27 | * |
---|
28 | * @endif |
---|
29 | */ |
---|
30 | |
---|
31 | |
---|
32 | #ifndef XPARSER_H_ALEIX0211250057 |
---|
33 | #define XPARSER_H_ALEIX0211250057 |
---|
34 | |
---|
35 | #include "parser.h" |
---|
36 | |
---|
37 | #include "xtree.h" |
---|
38 | #include "xelement.h" |
---|
39 | |
---|
40 | |
---|
41 | /* Stack to keep previous parsed elements */ |
---|
42 | typedef struct _stack_element |
---|
43 | { |
---|
44 | scew_element* element; |
---|
45 | struct _stack_element* prev; |
---|
46 | } stack_element; |
---|
47 | |
---|
48 | struct _scew_parser |
---|
49 | { |
---|
50 | XML_Parser parser; /* Expat parser */ |
---|
51 | scew_tree* tree; /* XML document tree */ |
---|
52 | scew_element* current; /* Current parsed element */ |
---|
53 | stack_element* stack; /* Current parsed element stack */ |
---|
54 | int ignore_whitespaces; /* 1 if ignore white spaces, 0 otherwise */ |
---|
55 | SCEW_CALLBACK* stream_callback; /* Function to call while reading streams */ |
---|
56 | }; |
---|
57 | |
---|
58 | /* Creates and initializes Expat parser. */ |
---|
59 | unsigned int |
---|
60 | init_expat_parser(scew_parser* parser); |
---|
61 | |
---|
62 | /* Pushes an element into the stack. */ |
---|
63 | stack_element* |
---|
64 | stack_push(stack_element** stack, scew_element* element); |
---|
65 | |
---|
66 | /* Pops an element from the stack. */ |
---|
67 | scew_element* |
---|
68 | stack_pop(stack_element** stack); |
---|
69 | |
---|
70 | #endif /* XPARSER_H_ALEIX0211250057 */ |
---|