libsyncml  0.5.4
sml_xml_parse_internals.h
1 /*
2  * libsyncml - A syncml protocol implementation
3  * Copyright (C) 2005 Armin Bauer <armin.bauer@opensync.org>
4  * Copyright (C) 2008 Michael Bell <michael.bell@opensync.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
35 
36 #ifndef _SML_XML_PARSE_INTERNALS_H_
37 #define _SML_XML_PARSE_INTERNALS_H_
38 
39 #include <libxml/xmlreader.h>
40 #include <libxml/xmlwriter.h>
41 
42 #define XML_NODE_START 1
43 #define XML_NODE_TEXT 3
44 #define XML_NODE_CLOSE 15
45 #define XML_NODE_CDATA 4
46 
47 struct SmlXmlParser {
49  SmlProtocolVersion version;
50  xmlTextReader *reader;
51  char *data;
52  unsigned int size;
53  SmlTransport *tsp;
54  SmlMimeType type;
55  SmlBool got_command;
56  SmlBool gotMoreData;
57 };
58 
59 SmlBool smlParserStep(SmlParser *parser);
60 SmlBool smlParserExpectNode(SmlParser *parser, int type, SmlBool empty, const char *name, SmlError **error);
61 SmlBool smlParserGetID(SmlParser *parser, unsigned int *id, const char *name, SmlError **error);
62 SmlBool smlParserGetString(SmlParser *parser, char **string, const char *name, SmlError **error);
63 SmlBool smlParserGetData(SmlParser *parser, char **string, unsigned int *size, const char *name, SmlError **error);
64 
65 #endif //_SML_XML_PARSE_INTERNALS_H_
66 
SmlProtocolVersion version
Represent an error.