+ The return value is 0 for success or -1 for error. It may throw,
+ but only if something unexpected goes wrong during parsing; parse
+ errors will be caught, warned about, and reported as failure. */
+ int parse (const char *buffer);
+
+ /* Issue a debugging message. */
+ void vdebug (const char *format, va_list ap)
+ ATTRIBUTE_PRINTF (2, 0);
+
+ /* Issue an error message, and stop parsing. */
+ void verror (const char *format, va_list ap)
+ ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 0);
+
+ void body_text (const XML_Char *text, int length);
+ void start_element (const XML_Char *name, const XML_Char **attrs);
+ void end_element (const XML_Char *name);
+
+ /* Return the name of this parser. */
+ const char *name ()
+ { return m_name; }
+
+ /* Return the user's callback data, for handlers. */
+ void *user_data ()
+ { return m_user_data; };
+
+ /* Are we the special <xi:include> parser? */
+ void set_is_xinclude (bool is_xinclude)
+ { m_is_xinclude = is_xinclude; }
+
+ /* A thrown error, if any. */
+ void set_error (gdb_exception &&error)
+ {
+ m_error = std::move (error);
+#ifdef HAVE_XML_STOPPARSER
+ XML_StopParser (m_expat_parser, XML_FALSE);
+#endif
+ }
+
+ /* Return the underlying expat parser. */
+ XML_Parser expat_parser ()
+ { return m_expat_parser; }
+
+private:
+ /* The underlying expat parser. */
+ XML_Parser m_expat_parser;
+
+ /* Name of this parser. */
+ const char *m_name;
+
+ /* The user's callback data, for handlers. */
+ void *m_user_data;