1 /* Copyright and license information is at the end of the file */
3 #ifndef XMLRPC_XMLPARSER_H_INCLUDED
4 #define XMLRPC_XMLPARSER_H_INCLUDED
6 /*=========================================================================
7 ** Abstract XML Parser Interface
8 **=========================================================================
9 ** This file provides an abstract interface to the XML parser. For now,
10 ** this interface is implemented by expat, but feel free to change it
15 /*=========================================================================
17 **=========================================================================
18 ** This data structure represents an XML element. We provide no more API
19 ** than we'll need in xmlrpc_parse.c.
21 ** The pointers returned by the various accessor methods belong to the
22 ** xml_element structure. Do not free them, and do not use them after
23 ** the xml_element has been destroyed.
26 /* You'll need to finish defining struct _xml_element elsewhere. */
27 typedef struct _xml_element xml_element;
29 /* Destroy an xml_element. */
30 void xml_element_free (xml_element *elem);
32 /* Return a pointer to the element's name. Do not free this pointer!
33 ** This pointer should point to standard ASCII or UTF-8 data. */
35 xml_element_name(const xml_element * const elemP);
37 /* Return the xml_element's CDATA. Do not free this pointer!
38 ** This pointer should point to standard ASCII or UTF-8 data.
39 ** The implementation is allowed to concatenate all the CDATA in the
40 ** element regardless of child elements. Alternatively, if there are
41 ** any child elements, the implementation is allowed to dispose
42 ** of whitespace characters.
43 ** The value returned by xml_element_cdata should be '\0'-terminated
44 ** (although it may contain other '\0' characters internally).
45 ** xml_element_cdata_size should not include the final '\0'. */
46 size_t xml_element_cdata_size (xml_element *elem);
47 char *xml_element_cdata (xml_element *elem);
49 /* Return the xml_element's child elements. Do not free this pointer! */
51 xml_element_children_size(const xml_element * const elemP);
54 xml_element_children(const xml_element * const elemP);
57 /*=========================================================================
59 **=========================================================================
60 ** Parse a chunk of XML data and return the top-level element. If this
61 ** routine fails, it will return NULL and set up the env appropriately.
62 ** You are responsible for calling xml_element_free on the returned pointer.
66 xml_parse(xmlrpc_env * const envP,
67 const char * const xmlData,
68 size_t const xmlDataLen,
69 xml_element ** const resultPP);
72 /* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
74 ** Redistribution and use in source and binary forms, with or without
75 ** modification, are permitted provided that the following conditions
77 ** 1. Redistributions of source code must retain the above copyright
78 ** notice, this list of conditions and the following disclaimer.
79 ** 2. Redistributions in binary form must reproduce the above copyright
80 ** notice, this list of conditions and the following disclaimer in the
81 ** documentation and/or other materials provided with the distribution.
82 ** 3. The name of the author may not be used to endorse or promote products
83 ** derived from this software without specific prior written permission.
85 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
86 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
87 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
88 ** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
89 ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
90 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
91 ** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
92 ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
93 ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
94 ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF