Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /trunk/src/xmlparse.h
Parent Directory
|
Revision Log
Revision 337 -
(show annotations)
(download)
(as text)
Mon Mar 29 18:13:20 2010 UTC (14 years, 11 months ago) by amb
File MIME type: text/x-chdr
File size: 1877 byte(s)
Mon Mar 29 18:13:20 2010 UTC (14 years, 11 months ago) by amb
File MIME type: text/x-chdr
File size: 1877 byte(s)
Add the option to ignore unknown attributes.
1 | /*************************************** |
2 | $Header: /home/amb/CVS/routino/src/xmlparse.h,v 1.2 2010-03-29 18:13:20 amb Exp $ |
3 | |
4 | A simple XML parser |
5 | |
6 | Part of the Routino routing software. |
7 | ******************/ /****************** |
8 | This file Copyright 2010 Andrew M. Bishop |
9 | |
10 | This program is free software: you can redistribute it and/or modify |
11 | it under the terms of the GNU Affero General Public License as published by |
12 | the Free Software Foundation, either version 3 of the License, or |
13 | (at your option) any later version. |
14 | |
15 | This program is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | GNU Affero General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU Affero General Public License |
21 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
22 | ***************************************/ |
23 | |
24 | |
25 | #ifndef XMLPARSE_H |
26 | #define XMLPARSE_H /*+ To stop multiple inclusions. +*/ |
27 | |
28 | #include <stdio.h> |
29 | |
30 | |
31 | /*+ The maximum number of attributes per tag. +*/ |
32 | #define XMLPARSE_MAX_ATTRS 16 |
33 | |
34 | /*+ The maximum number of subtags per tag. +*/ |
35 | #define XMLPARSE_MAX_SUBTAGS 16 |
36 | |
37 | |
38 | /*+ A forward definition of the xmltag +*/ |
39 | typedef struct _xmltag xmltag; |
40 | |
41 | |
42 | /*+ A structure to hold the definition of a tag. +*/ |
43 | struct _xmltag |
44 | { |
45 | char *name; /*+ The name of the tag. +*/ |
46 | |
47 | char *attributes[XMLPARSE_MAX_ATTRS]; /*+ The valid attributes for the tag (null terminated). +*/ |
48 | |
49 | void (*callback)(); /*+ The callback function when the tag is seen. +*/ |
50 | |
51 | xmltag *subtags[XMLPARSE_MAX_SUBTAGS]; /*+ The list of valid tags contained within this one (null terminated). +*/ |
52 | }; |
53 | |
54 | |
55 | /* XML parser function */ |
56 | |
57 | void ParseXML(FILE *file,xmltag **tags,int ignore_unknown_attributes); |
58 | |
59 | |
60 | #endif /* XMLPARSE_H */ |
Properties
Name | Value |
---|---|
cvs:description | A simple generic XML parser (header file). |