1/*
2   XML/HTTP response handling
3   Copyright (C) 2004-2006, Joe Orton <joe@manyfish.co.uk>
4
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Library General Public
7   License as published by the Free Software Foundation; either
8   version 2 of the License, or (at your option) any later version.
9
10   This library is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   Library General Public License for more details.
14
15   You should have received a copy of the GNU Library General Public
16   License along with this library; if not, write to the Free
17   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18   MA 02111-1307, USA
19
20*/
21
22#ifndef NE_XMLREQ_H
23#define NE_XMLREQ_H
24
25#include "ne_request.h"
26#include "ne_xml.h"
27
28NE_BEGIN_DECLS
29
30/* Read the HTTP response body using calls to ne_read_response_block
31 * (so must be enclosed by ne_begin_request/ne_end_request calls), and
32 * parse it as an XML document, using the given parser.  Returns NE_*
33 * error codes.  If an XML parse error occurs, the session error
34 * string is set to the XML parser's error string, and NE_ERROR is
35 * returned. */
36int ne_xml_parse_response(ne_request *req, ne_xml_parser *parser);
37
38/* Dispatch the HTTP request, parsing the response body as an XML
39 * document using the given parser, if the response status class is
40 * 2xx and an XML media type is specified for the response entity.  If
41 * a non-2xx response code is given, or a non-XML media type is
42 * specified, then the response body will be silently discarded.
43 *
44 * Returns NE_* error codes.  If an XML parse error occurs, the
45 * session error string is set to the XML parser's error string, and
46 * NE_ERROR is returned. */
47int ne_xml_dispatch_request(ne_request *req, ne_xml_parser *parser);
48
49NE_END_DECLS
50
51#endif /* NE_XMLREQ_H */
52