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