Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Annotation of /trunk/src/xmlparse.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 356 - (hide annotations) (download) (as text)
Thu Apr 8 17:21:45 2010 UTC (14 years, 11 months ago) by amb
File MIME type: text/x-chdr
File size: 2282 byte(s)
Make the strings const and add the number of attributes to the xmltag structure.
Add functions to convert character entities and character references.

1 amb 335 /***************************************
2 amb 356 $Header: /home/amb/CVS/routino/src/xmlparse.h,v 1.5 2010-04-08 17:21:45 amb Exp $
3 amb 335
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 amb 344 /*+ A flag to indicate the start and/or end of a tag. +*/
38     #define XMLPARSE_TAG_START 1
39     #define XMLPARSE_TAG_END 2
40 amb 335
41 amb 344
42 amb 335 /*+ A forward definition of the xmltag +*/
43     typedef struct _xmltag xmltag;
44    
45    
46     /*+ A structure to hold the definition of a tag. +*/
47     struct _xmltag
48     {
49     char *name; /*+ The name of the tag. +*/
50    
51 amb 356 int nattributes; /*+ The number of valid attributes for the tag. +*/
52     char *attributes[XMLPARSE_MAX_ATTRS]; /*+ The valid attributes for the tag. +*/
53 amb 335
54     void (*callback)(); /*+ The callback function when the tag is seen. +*/
55    
56     xmltag *subtags[XMLPARSE_MAX_SUBTAGS]; /*+ The list of valid tags contained within this one (null terminated). +*/
57     };
58    
59    
60     /* XML parser function */
61    
62 amb 348 int ParseXML(FILE *file,xmltag **tags,int ignore_unknown_attributes);
63 amb 335
64 amb 348 int ParseXML_LineNumber(void);
65 amb 335
66 amb 356 const char *ParseXML_Decode_Entity_Ref(const char *string);
67     const char *ParseXML_Decode_Char_Ref(const char *string);
68     const char *ParseXML_Encode_Safe_XML(const char *string);
69 amb 348
70 amb 356
71 amb 335 #endif /* XMLPARSE_H */

Properties

Name Value
cvs:description A simple generic XML parser (header file).