/* XdParser.c generated by valac 0.56.19, the Vala compiler
 * generated from XdParser.vala, do not modify */

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/*
 *
 * Copyright (C) 2019  Daniel Espinosa <esodan@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Daniel Espinosa <esodan@gmail.com>
 */

#include <glib-object.h>
#include "gxml/gxml.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <libxml/xmlerror.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <glib/gi18n-lib.h>
#include "gxml.h"

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define GXML_TYPE_XD_PARSER (gxml_xd_parser_get_type ())
#define GXML_XD_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_XD_PARSER, GXmlXdParser))
#define GXML_XD_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_XD_PARSER, GXmlXdParserClass))
#define GXML_IS_XD_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_XD_PARSER))
#define GXML_IS_XD_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_XD_PARSER))
#define GXML_XD_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_XD_PARSER, GXmlXdParserClass))

typedef struct _GXmlXdParser GXmlXdParser;
typedef struct _GXmlXdParserClass GXmlXdParserClass;
typedef struct _GXmlXdParserPrivate GXmlXdParserPrivate;
enum  {
	GXML_XD_PARSER_0_PROPERTY,
	GXML_XD_PARSER_BACKUP_PROPERTY,
	GXML_XD_PARSER_INDENT_PROPERTY,
	GXML_XD_PARSER_TYPES_PROPERTY,
	GXML_XD_PARSER_NODE_PROPERTY,
	GXML_XD_PARSER_CANCELLABLE_PROPERTY,
	GXML_XD_PARSER_NUM_PROPERTIES
};
static GParamSpec* gxml_xd_parser_properties[GXML_XD_PARSER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _GxmlXdParserCreateStreamAsyncData GxmlXdParserCreateStreamAsyncData;
typedef struct _GxmlXdParserReadStreamAsyncData GxmlXdParserReadStreamAsyncData;
#define _xmlFreeDoc0(var) ((var == NULL) ? NULL : (var = (xmlFreeDoc (var), NULL)))
typedef struct _GxmlXdParserReadStringAsyncData GxmlXdParserReadStringAsyncData;
typedef struct _GxmlXdParserWriteStreamAsyncData GxmlXdParserWriteStreamAsyncData;
typedef struct _GxmlXdParserWriteStringAsyncData GxmlXdParserWriteStringAsyncData;

struct _GXmlXdParser {
	GObject parent_instance;
	GXmlXdParserPrivate * priv;
};

struct _GXmlXdParserClass {
	GObjectClass parent_class;
};

struct _GXmlXdParserPrivate {
	GXmlXDocument* document;
	GXmlDomNode* _node;
	GHashTable* _types;
	gboolean _backup;
	gboolean _indent;
	GCancellable* _cancellable;
};

struct _GxmlXdParserCreateStreamAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlXdParser* self;
	GInputStream* result;
	GInputStream* _tmp0_;
	GInputStream* _tmp1_;
	GInputStream* _tmp2_;
	GError* _inner_error0_;
};

struct _GxmlXdParserReadStreamAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlXdParser* self;
	GInputStream* stream;
	GError* _inner_error0_;
};

struct _GxmlXdParserReadStringAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlXdParser* self;
	gchar* str;
	GError* _inner_error0_;
};

struct _GxmlXdParserWriteStreamAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlXdParser* self;
	GOutputStream* stream;
	GInputStream* istream;
	GInputStream* _tmp0_;
	GInputStream* _tmp1_;
	GCancellable* _tmp2_;
	GCancellable* _tmp3_;
	GError* _inner_error0_;
};

struct _GxmlXdParserWriteStringAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlXdParser* self;
	gchar* result;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GError* _inner_error0_;
};

static gint GXmlXdParser_private_offset;
static gpointer gxml_xd_parser_parent_class = NULL;
static GXmlParserIface * gxml_xd_parser_gxml_parser_parent_iface = NULL;

VALA_EXTERN GType gxml_xd_parser_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GXmlXdParser* gxml_xd_parser_new (GXmlXDocument* doc);
VALA_EXTERN GXmlXdParser* gxml_xd_parser_construct (GType object_type,
                                        GXmlXDocument* doc);
static GXmlDomElement* gxml_xd_parser_real_create_element (GXmlParser* base,
                                                    GXmlDomNode* parent,
                                                    GError** error);
static GInputStream* gxml_xd_parser_real_create_stream (GXmlParser* base,
                                                 GError** error);
static guint8* _vala_array_dup6 (guint8* self,
                          gssize length);
static void gxml_xd_parser_real_create_stream_async_data_free (gpointer _data);
static void gxml_xd_parser_real_create_stream_async (GXmlParser* base,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static gboolean gxml_xd_parser_real_create_stream_async_co (GxmlXdParserCreateStreamAsyncData* _data_);
static gboolean _gxml_xd_parser_real_create_stream_async_co_gsource_func (gpointer self);
static gboolean gxml_xd_parser_real_current_is_document (GXmlParser* base);
static gboolean gxml_xd_parser_real_current_is_element (GXmlParser* base);
static gboolean gxml_xd_parser_real_current_is_empty_element (GXmlParser* base);
static gchar* gxml_xd_parser_real_current_node_name (GXmlParser* base);
static gboolean gxml_xd_parser_real_move_next_node (GXmlParser* base,
                                             GError** error);
static gboolean gxml_xd_parser_real_read_child_node (GXmlParser* base,
                                              GXmlDomNode* parent,
                                              GError** error);
static void gxml_xd_parser_real_read_child_nodes_stream (GXmlParser* base,
                                                  GInputStream* istream,
                                                  GError** error);
static void gxml_xd_parser_real_read_element (GXmlParser* base,
                                       GXmlDomElement* element,
                                       GError** error);
static void gxml_xd_parser_real_read_stream (GXmlParser* base,
                                      GInputStream* stream,
                                      GError** error);
static void gxml_xd_parser_real_read_stream_async_data_free (gpointer _data);
static void gxml_xd_parser_real_read_stream_async (GXmlParser* base,
                                            GInputStream* stream,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static gboolean gxml_xd_parser_real_read_stream_async_co (GxmlXdParserReadStreamAsyncData* _data_);
static gboolean _gxml_xd_parser_real_read_stream_async_co_gsource_func (gpointer self);
static void gxml_xd_parser_real_read_string (GXmlParser* base,
                                      const gchar* str,
                                      GError** error);
VALA_EXTERN gchar* gxml_xnode_libxml2_error_to_string (xmlError* e);
static void gxml_xd_parser_real_read_string_async_data_free (gpointer _data);
static void gxml_xd_parser_real_read_string_async (GXmlParser* base,
                                            const gchar* str,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static gboolean gxml_xd_parser_real_read_string_async_co (GxmlXdParserReadStringAsyncData* _data_);
static gboolean _gxml_xd_parser_real_read_string_async_co_gsource_func (gpointer self);
static gchar* gxml_xd_parser_real_read_unparsed (GXmlParser* base,
                                          GError** error);
static void gxml_xd_parser_real_write_stream (GXmlParser* base,
                                       GOutputStream* stream,
                                       GError** error);
static void gxml_xd_parser_real_write_stream_async_data_free (gpointer _data);
static void gxml_xd_parser_real_write_stream_async (GXmlParser* base,
                                             GOutputStream* stream,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static gboolean gxml_xd_parser_real_write_stream_async_co (GxmlXdParserWriteStreamAsyncData* _data_);
static void gxml_xd_parser_write_stream_async_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static gchar* gxml_xd_parser_real_write_string (GXmlParser* base,
                                         GError** error);
static void gxml_xd_parser_real_write_string_async_data_free (gpointer _data);
static void gxml_xd_parser_real_write_string_async (GXmlParser* base,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static gboolean gxml_xd_parser_real_write_string_async_co (GxmlXdParserWriteStringAsyncData* _data_);
static gboolean _gxml_xd_parser_real_write_string_async_co_gsource_func (gpointer self);
static GObject * gxml_xd_parser_constructor (GType type,
                                      guint n_construct_properties,
                                      GObjectConstructParam * construct_properties);
static void _g_hash_table_unref0_ (gpointer var);
static void gxml_xd_parser_finalize (GObject * obj);
static GType gxml_xd_parser_get_type_once (void);
static void _vala_gxml_xd_parser_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static void _vala_gxml_xd_parser_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
gxml_xd_parser_get_instance_private (GXmlXdParser* self)
{
	return G_STRUCT_MEMBER_P (self, GXmlXdParser_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

GXmlXdParser*
gxml_xd_parser_construct (GType object_type,
                          GXmlXDocument* doc)
{
	GXmlXdParser * self = NULL;
	GXmlXDocument* _tmp0_;
	GXmlDomNode* _tmp1_;
	g_return_val_if_fail (doc != NULL, NULL);
	self = (GXmlXdParser*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (doc);
	_g_object_unref0 (self->priv->document);
	self->priv->document = _tmp0_;
	_tmp1_ = _g_object_ref0 ((GXmlDomNode*) doc);
	_g_object_unref0 (self->priv->_node);
	self->priv->_node = _tmp1_;
	return self;
}

GXmlXdParser*
gxml_xd_parser_new (GXmlXDocument* doc)
{
	return gxml_xd_parser_construct (GXML_TYPE_XD_PARSER, doc);
}

static GXmlDomElement*
gxml_xd_parser_real_create_element (GXmlParser* base,
                                    GXmlDomNode* parent,
                                    GError** error)
{
	GXmlXdParser * self;
	GXmlDomElement* result;
	self = (GXmlXdParser*) base;
	g_return_val_if_fail (parent != NULL, NULL);
	result = NULL;
	return result;
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static guint8*
_vala_array_dup6 (guint8* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static GInputStream*
gxml_xd_parser_real_create_stream (GXmlParser* base,
                                   GError** error)
{
	GXmlXdParser * self;
	gchar* str = NULL;
	GXmlXDocument* _tmp0_;
	gchar* _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	gint _tmp3_ = 0;
	guint8* _tmp4_;
	gint _tmp4__length1;
	guint8* _tmp5_;
	gint _tmp5__length1;
	GDestroyNotify _tmp6_;
	GMemoryInputStream* _tmp7_;
	GInputStream* result;
	self = (GXmlXdParser*) base;
	_tmp0_ = self->priv->document;
	_tmp1_ = gxml_xdocument_libxml_to_string (_tmp0_);
	str = _tmp1_;
	_tmp2_ = string_get_data (str, &_tmp3_);
	_tmp2__length1 = _tmp3_;
	_tmp4_ = _tmp2_;
	_tmp4__length1 = _tmp2__length1;
	_tmp5_ = (_tmp4_ != NULL) ? _vala_array_dup6 (_tmp4_, _tmp4__length1) : _tmp4_;
	_tmp5__length1 = _tmp4__length1;
	_tmp6_ = g_free;
	_tmp7_ = (GMemoryInputStream*) g_memory_input_stream_new_from_data (_tmp5_, _tmp5__length1, _tmp6_);
	result = (GInputStream*) _tmp7_;
	_g_free0 (str);
	return result;
}

static void
gxml_xd_parser_real_create_stream_async_data_free (gpointer _data)
{
	GxmlXdParserCreateStreamAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlXdParserCreateStreamAsyncData, _data_);
}

static void
gxml_xd_parser_real_create_stream_async (GXmlParser* base,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	GXmlXdParser * self;
	GxmlXdParserCreateStreamAsyncData* _data_;
	GXmlXdParser* _tmp0_;
	self = (GXmlXdParser*) base;
	_data_ = g_slice_new0 (GxmlXdParserCreateStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_xd_parser_real_create_stream_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	gxml_xd_parser_real_create_stream_async_co (_data_);
}

static GInputStream*
gxml_xd_parser_create_stream_finish (GXmlParser* base,
                                     GAsyncResult* _res_,
                                     GError** error)
{
	GInputStream* result;
	GxmlXdParserCreateStreamAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gboolean
_gxml_xd_parser_real_create_stream_async_co_gsource_func (gpointer self)
{
	gboolean result;
	result = gxml_xd_parser_real_create_stream_async_co (self);
	return result;
}

static gboolean
gxml_xd_parser_real_create_stream_async_co (GxmlXdParserCreateStreamAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _gxml_xd_parser_real_create_stream_async_co_gsource_func, _data_, NULL);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp1_ = gxml_parser_create_stream ((GXmlParser*) _data_->self, &_data_->_inner_error0_);
	_data_->_tmp0_ = _data_->_tmp1_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = _data_->_tmp0_;
	_data_->_tmp0_ = NULL;
	_data_->result = _data_->_tmp2_;
	_g_object_unref0 (_data_->_tmp0_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gboolean
gxml_xd_parser_real_current_is_document (GXmlParser* base)
{
	GXmlXdParser * self;
	gboolean result;
	self = (GXmlXdParser*) base;
	result = FALSE;
	return result;
}

static gboolean
gxml_xd_parser_real_current_is_element (GXmlParser* base)
{
	GXmlXdParser * self;
	gboolean result;
	self = (GXmlXdParser*) base;
	result = FALSE;
	return result;
}

static gboolean
gxml_xd_parser_real_current_is_empty_element (GXmlParser* base)
{
	GXmlXdParser * self;
	gboolean result;
	self = (GXmlXdParser*) base;
	result = FALSE;
	return result;
}

static gchar*
gxml_xd_parser_real_current_node_name (GXmlParser* base)
{
	GXmlXdParser * self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (GXmlXdParser*) base;
	_tmp0_ = gxml_parser_get_node ((GXmlParser*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gxml_dom_node_get_node_name (_tmp1_);
	_tmp3_ = _tmp2_;
	result = _tmp3_;
	return result;
}

static gboolean
gxml_xd_parser_real_move_next_node (GXmlParser* base,
                                    GError** error)
{
	GXmlXdParser * self;
	gboolean result;
	self = (GXmlXdParser*) base;
	result = FALSE;
	return result;
}

static gboolean
gxml_xd_parser_real_read_child_node (GXmlParser* base,
                                     GXmlDomNode* parent,
                                     GError** error)
{
	GXmlXdParser * self;
	gboolean result;
	self = (GXmlXdParser*) base;
	g_return_val_if_fail (parent != NULL, FALSE);
	result = FALSE;
	return result;
}

static void
gxml_xd_parser_real_read_child_nodes_stream (GXmlParser* base,
                                             GInputStream* istream,
                                             GError** error)
{
	GXmlXdParser * self;
	self = (GXmlXdParser*) base;
	g_return_if_fail (istream != NULL);
}

static void
gxml_xd_parser_real_read_element (GXmlParser* base,
                                  GXmlDomElement* element,
                                  GError** error)
{
	GXmlXdParser * self;
	self = (GXmlXdParser*) base;
	g_return_if_fail (element != NULL);
}

static void
gxml_xd_parser_real_read_stream (GXmlParser* base,
                                 GInputStream* stream,
                                 GError** error)
{
	GXmlXdParser * self;
	GDataInputStream* b = NULL;
	GDataInputStream* _tmp0_;
	gchar* text = NULL;
	GDataInputStream* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	GError* _inner_error0_ = NULL;
	self = (GXmlXdParser*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = g_data_input_stream_new (stream);
	b = _tmp0_;
	_tmp1_ = b;
	_tmp2_ = g_data_input_stream_read_upto (_tmp1_, "\0", (gssize) -1, NULL, NULL, &_inner_error0_);
	text = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (b);
		return;
	}
	_tmp3_ = text;
	gxml_parser_read_string ((GXmlParser*) self, _tmp3_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_free0 (text);
		_g_object_unref0 (b);
		return;
	}
	_g_free0 (text);
	_g_object_unref0 (b);
}

static void
gxml_xd_parser_real_read_stream_async_data_free (gpointer _data)
{
	GxmlXdParserReadStreamAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlXdParserReadStreamAsyncData, _data_);
}

static void
gxml_xd_parser_real_read_stream_async (GXmlParser* base,
                                       GInputStream* stream,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	GXmlXdParser * self;
	GxmlXdParserReadStreamAsyncData* _data_;
	GXmlXdParser* _tmp0_;
	GInputStream* _tmp1_;
	g_return_if_fail (stream != NULL);
	self = (GXmlXdParser*) base;
	_data_ = g_slice_new0 (GxmlXdParserReadStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_xd_parser_real_read_stream_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	gxml_xd_parser_real_read_stream_async_co (_data_);
}

static void
gxml_xd_parser_read_stream_finish (GXmlParser* base,
                                   GAsyncResult* _res_,
                                   GError** error)
{
	GxmlXdParserReadStreamAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
_gxml_xd_parser_real_read_stream_async_co_gsource_func (gpointer self)
{
	gboolean result;
	result = gxml_xd_parser_real_read_stream_async_co (self);
	return result;
}

static gboolean
gxml_xd_parser_real_read_stream_async_co (GxmlXdParserReadStreamAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _gxml_xd_parser_real_read_stream_async_co_gsource_func, _data_, NULL);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	gxml_parser_read_stream ((GXmlParser*) _data_->self, _data_->stream, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
gxml_xd_parser_real_read_string (GXmlParser* base,
                                 const gchar* str,
                                 GError** error)
{
	GXmlXdParser * self;
	GXmlXDocument* _tmp0_;
	xmlDoc* _tmp1_;
	GXmlXDocument* _tmp4_;
	GXmlXDocument* _tmp5_;
	gint _tmp6_;
	gint _tmp7_;
	xmlDoc* _tmp8_;
	xmlError* e = NULL;
	xmlError* _tmp9_;
	xmlError* _tmp10_;
	GXmlXDocument* _tmp18_;
	xmlDoc* _tmp19_;
	GError* _inner_error0_ = NULL;
	self = (GXmlXdParser*) base;
	g_return_if_fail (str != NULL);
	xmlResetLastError ();
	_tmp0_ = self->priv->document;
	_tmp1_ = _tmp0_->doc;
	if (_tmp1_ != NULL) {
		GXmlXDocument* _tmp2_;
		xmlDoc* _tmp3_;
		_tmp2_ = self->priv->document;
		_tmp3_ = _tmp2_->doc;
		_xmlFreeDoc0 (_tmp3_);
	}
	_tmp4_ = self->priv->document;
	_tmp4_->doc = NULL;
	_tmp5_ = self->priv->document;
	_tmp6_ = strlen (str);
	_tmp7_ = _tmp6_;
	_tmp8_ = xmlReadMemory (str, _tmp7_, NULL, NULL, 0);
	_tmp5_->doc = _tmp8_;
	_tmp9_ = xmlGetLastError ();
	e = _tmp9_;
	_tmp10_ = e;
	if (_tmp10_ != NULL) {
		gchar* errmsg = NULL;
		gchar* _tmp11_;
		gchar* s = NULL;
		xmlError* _tmp12_;
		gchar* _tmp13_;
		const gchar* _tmp14_;
		const gchar* _tmp16_;
		GError* _tmp17_;
		_tmp11_ = g_strdup (_ ("Parser Error for string"));
		errmsg = _tmp11_;
		_tmp12_ = e;
		_tmp13_ = gxml_xnode_libxml2_error_to_string (_tmp12_);
		s = _tmp13_;
		_tmp14_ = s;
		if (_tmp14_ != NULL) {
			gchar* _tmp15_;
			_tmp15_ = g_strdup (".  ");
			_g_free0 (errmsg);
			errmsg = _tmp15_;
		}
		_tmp16_ = errmsg;
		_tmp17_ = g_error_new_literal (GXML_ERROR, GXML_ERROR_PARSER, _tmp16_);
		_inner_error0_ = _tmp17_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (s);
		_g_free0 (errmsg);
		return;
	}
	_tmp18_ = self->priv->document;
	_tmp19_ = _tmp18_->doc;
	if (_tmp19_ == NULL) {
		GXmlXDocument* _tmp20_;
		xmlDoc* _tmp21_;
		_tmp20_ = self->priv->document;
		_tmp21_ = xmlNewDoc ((xmlChar*) NULL);
		_tmp20_->doc = _tmp21_;
	}
}

static void
gxml_xd_parser_real_read_string_async_data_free (gpointer _data)
{
	GxmlXdParserReadStringAsyncData* _data_;
	_data_ = _data;
	_g_free0 (_data_->str);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlXdParserReadStringAsyncData, _data_);
}

static void
gxml_xd_parser_real_read_string_async (GXmlParser* base,
                                       const gchar* str,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	GXmlXdParser * self;
	GxmlXdParserReadStringAsyncData* _data_;
	GXmlXdParser* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (str != NULL);
	self = (GXmlXdParser*) base;
	_data_ = g_slice_new0 (GxmlXdParserReadStringAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_xd_parser_real_read_string_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (str);
	_g_free0 (_data_->str);
	_data_->str = _tmp1_;
	gxml_xd_parser_real_read_string_async_co (_data_);
}

static void
gxml_xd_parser_read_string_finish (GXmlParser* base,
                                   GAsyncResult* _res_,
                                   GError** error)
{
	GxmlXdParserReadStringAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static gboolean
_gxml_xd_parser_real_read_string_async_co_gsource_func (gpointer self)
{
	gboolean result;
	result = gxml_xd_parser_real_read_string_async_co (self);
	return result;
}

static gboolean
gxml_xd_parser_real_read_string_async_co (GxmlXdParserReadStringAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _gxml_xd_parser_real_read_string_async_co_gsource_func, _data_, NULL);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	gxml_parser_read_string ((GXmlParser*) _data_->self, _data_->str, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gchar*
gxml_xd_parser_real_read_unparsed (GXmlParser* base,
                                   GError** error)
{
	GXmlXdParser * self;
	gchar* _tmp0_;
	gchar* result;
	self = (GXmlXdParser*) base;
	_tmp0_ = g_strdup ("");
	result = _tmp0_;
	return result;
}

static void
gxml_xd_parser_real_write_stream (GXmlParser* base,
                                  GOutputStream* stream,
                                  GError** error)
{
	GXmlXdParser * self;
	GInputStream* istream = NULL;
	GInputStream* _tmp0_;
	GInputStream* _tmp1_;
	GCancellable* _tmp2_;
	GCancellable* _tmp3_;
	GError* _inner_error0_ = NULL;
	self = (GXmlXdParser*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = gxml_parser_create_stream ((GXmlParser*) self, &_inner_error0_);
	istream = _tmp0_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp1_ = istream;
	_tmp2_ = gxml_parser_get_cancellable ((GXmlParser*) self);
	_tmp3_ = _tmp2_;
	g_output_stream_splice (stream, _tmp1_, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE, _tmp3_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (istream);
		return;
	}
	_g_object_unref0 (istream);
}

static void
gxml_xd_parser_real_write_stream_async_data_free (gpointer _data)
{
	GxmlXdParserWriteStreamAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlXdParserWriteStreamAsyncData, _data_);
}

static void
gxml_xd_parser_real_write_stream_async (GXmlParser* base,
                                        GOutputStream* stream,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	GXmlXdParser * self;
	GxmlXdParserWriteStreamAsyncData* _data_;
	GXmlXdParser* _tmp0_;
	GOutputStream* _tmp1_;
	g_return_if_fail (stream != NULL);
	self = (GXmlXdParser*) base;
	_data_ = g_slice_new0 (GxmlXdParserWriteStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_xd_parser_real_write_stream_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	gxml_xd_parser_real_write_stream_async_co (_data_);
}

static void
gxml_xd_parser_write_stream_finish (GXmlParser* base,
                                    GAsyncResult* _res_,
                                    GError** error)
{
	GxmlXdParserWriteStreamAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
gxml_xd_parser_write_stream_async_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	GxmlXdParserWriteStreamAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_xd_parser_real_write_stream_async_co (_data_);
}

static gboolean
gxml_xd_parser_real_write_stream_async_co (GxmlXdParserWriteStreamAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	gxml_parser_create_stream_async ((GXmlParser*) _data_->self, gxml_xd_parser_write_stream_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp0_ = gxml_parser_create_stream_finish ((GXmlParser*) _data_->self, _data_->_res_, &_data_->_inner_error0_);
	_data_->istream = _data_->_tmp0_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = _data_->istream;
	_data_->_tmp2_ = gxml_parser_get_cancellable ((GXmlParser*) _data_->self);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_state_ = 2;
	g_output_stream_splice_async (_data_->stream, _data_->_tmp1_, G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE, 0, _data_->_tmp3_, gxml_xd_parser_write_stream_async_ready, _data_);
	return FALSE;
	_state_2:
	g_output_stream_splice_finish (_data_->stream, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->istream);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->istream);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gchar*
gxml_xd_parser_real_write_string (GXmlParser* base,
                                  GError** error)
{
	GXmlXdParser * self;
	GXmlXDocument* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	self = (GXmlXdParser*) base;
	_tmp0_ = self->priv->document;
	_tmp1_ = gxml_xdocument_libxml_to_string (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
gxml_xd_parser_real_write_string_async_data_free (gpointer _data)
{
	GxmlXdParserWriteStringAsyncData* _data_;
	_data_ = _data;
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlXdParserWriteStringAsyncData, _data_);
}

static void
gxml_xd_parser_real_write_string_async (GXmlParser* base,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	GXmlXdParser * self;
	GxmlXdParserWriteStringAsyncData* _data_;
	GXmlXdParser* _tmp0_;
	self = (GXmlXdParser*) base;
	_data_ = g_slice_new0 (GxmlXdParserWriteStringAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_xd_parser_real_write_string_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	gxml_xd_parser_real_write_string_async_co (_data_);
}

static gchar*
gxml_xd_parser_write_string_finish (GXmlParser* base,
                                    GAsyncResult* _res_,
                                    GError** error)
{
	gchar* result;
	GxmlXdParserWriteStringAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gboolean
_gxml_xd_parser_real_write_string_async_co_gsource_func (gpointer self)
{
	gboolean result;
	result = gxml_xd_parser_real_write_string_async_co (self);
	return result;
}

static gboolean
gxml_xd_parser_real_write_string_async_co (GxmlXdParserWriteStringAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _gxml_xd_parser_real_write_string_async_co_gsource_func, _data_, NULL);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp1_ = gxml_parser_write_string ((GXmlParser*) _data_->self, &_data_->_inner_error0_);
	_data_->_tmp0_ = _data_->_tmp1_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = _data_->_tmp0_;
	_data_->_tmp0_ = NULL;
	_data_->result = _data_->_tmp2_;
	_g_free0 (_data_->_tmp0_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gboolean
gxml_xd_parser_real_get_backup (GXmlParser* base)
{
	gboolean result;
	GXmlXdParser* self;
	self = (GXmlXdParser*) base;
	result = self->priv->_backup;
	return result;
}

static void
gxml_xd_parser_real_set_backup (GXmlParser* base,
                                gboolean value)
{
	GXmlXdParser* self;
	gboolean old_value;
	self = (GXmlXdParser*) base;
	old_value = gxml_xd_parser_real_get_backup (base);
	if (old_value != value) {
		self->priv->_backup = value;
		g_object_notify_by_pspec ((GObject *) self, gxml_xd_parser_properties[GXML_XD_PARSER_BACKUP_PROPERTY]);
	}
}

static gboolean
gxml_xd_parser_real_get_indent (GXmlParser* base)
{
	gboolean result;
	GXmlXdParser* self;
	self = (GXmlXdParser*) base;
	result = self->priv->_indent;
	return result;
}

static void
gxml_xd_parser_real_set_indent (GXmlParser* base,
                                gboolean value)
{
	GXmlXdParser* self;
	gboolean old_value;
	self = (GXmlXdParser*) base;
	old_value = gxml_xd_parser_real_get_indent (base);
	if (old_value != value) {
		self->priv->_indent = value;
		g_object_notify_by_pspec ((GObject *) self, gxml_xd_parser_properties[GXML_XD_PARSER_INDENT_PROPERTY]);
	}
}

static GHashTable*
gxml_xd_parser_real_get_types (GXmlParser* base)
{
	GHashTable* result;
	GXmlXdParser* self;
	GHashTable* _tmp0_;
	self = (GXmlXdParser*) base;
	_tmp0_ = self->priv->_types;
	result = _tmp0_;
	return result;
}

static GXmlDomNode*
gxml_xd_parser_real_get_node (GXmlParser* base)
{
	GXmlDomNode* result;
	GXmlXdParser* self;
	GXmlDomNode* _tmp0_;
	self = (GXmlXdParser*) base;
	_tmp0_ = self->priv->_node;
	result = _tmp0_;
	return result;
}

static GCancellable*
gxml_xd_parser_real_get_cancellable (GXmlParser* base)
{
	GCancellable* result;
	GXmlXdParser* self;
	GCancellable* _tmp0_;
	self = (GXmlXdParser*) base;
	_tmp0_ = self->priv->_cancellable;
	result = _tmp0_;
	return result;
}

static void
gxml_xd_parser_real_set_cancellable (GXmlParser* base,
                                     GCancellable* value)
{
	GXmlXdParser* self;
	GCancellable* old_value;
	self = (GXmlXdParser*) base;
	old_value = gxml_xd_parser_real_get_cancellable (base);
	if (old_value != value) {
		GCancellable* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_cancellable);
		self->priv->_cancellable = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gxml_xd_parser_properties[GXML_XD_PARSER_CANCELLABLE_PROPERTY]);
	}
}

static void
_g_hash_table_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL));
}

static GObject *
gxml_xd_parser_constructor (GType type,
                            guint n_construct_properties,
                            GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GXmlXdParser * self;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	parent_class = G_OBJECT_CLASS (gxml_xd_parser_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_XD_PARSER, GXmlXdParser);
	_tmp0_ = g_int_hash;
	_tmp1_ = g_int_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, NULL, _g_hash_table_unref0_);
	_g_hash_table_unref0 (self->priv->_types);
	self->priv->_types = _tmp2_;
	return obj;
}

static void
gxml_xd_parser_class_init (GXmlXdParserClass * klass,
                           gpointer klass_data)
{
	gxml_xd_parser_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GXmlXdParser_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_xd_parser_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gxml_xd_parser_set_property;
	G_OBJECT_CLASS (klass)->constructor = gxml_xd_parser_constructor;
	G_OBJECT_CLASS (klass)->finalize = gxml_xd_parser_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XD_PARSER_BACKUP_PROPERTY, gxml_xd_parser_properties[GXML_XD_PARSER_BACKUP_PROPERTY] = g_param_spec_boolean ("backup", "backup", "backup", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XD_PARSER_INDENT_PROPERTY, gxml_xd_parser_properties[GXML_XD_PARSER_INDENT_PROPERTY] = g_param_spec_boolean ("indent", "indent", "indent", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XD_PARSER_TYPES_PROPERTY, gxml_xd_parser_properties[GXML_XD_PARSER_TYPES_PROPERTY] = g_param_spec_boxed ("types", "types", "types", G_TYPE_HASH_TABLE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XD_PARSER_NODE_PROPERTY, gxml_xd_parser_properties[GXML_XD_PARSER_NODE_PROPERTY] = g_param_spec_object ("node", "node", "node", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XD_PARSER_CANCELLABLE_PROPERTY, gxml_xd_parser_properties[GXML_XD_PARSER_CANCELLABLE_PROPERTY] = g_param_spec_object ("cancellable", "cancellable", "cancellable", g_cancellable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
gxml_xd_parser_gxml_parser_interface_init (GXmlParserIface * iface,
                                           gpointer iface_data)
{
	gxml_xd_parser_gxml_parser_parent_iface = g_type_interface_peek_parent (iface);
	iface->create_element = (GXmlDomElement* (*) (GXmlParser*, GXmlDomNode*, GError**)) gxml_xd_parser_real_create_element;
	iface->create_stream = (GInputStream* (*) (GXmlParser*, GError**)) gxml_xd_parser_real_create_stream;
	iface->create_stream_async = (void (*) (GXmlParser*, GAsyncReadyCallback, gpointer)) gxml_xd_parser_real_create_stream_async;
	iface->create_stream_finish = (GInputStream* (*) (GXmlParser*, GAsyncResult*, GError**)) gxml_xd_parser_create_stream_finish;
	iface->current_is_document = (gboolean (*) (GXmlParser*)) gxml_xd_parser_real_current_is_document;
	iface->current_is_element = (gboolean (*) (GXmlParser*)) gxml_xd_parser_real_current_is_element;
	iface->current_is_empty_element = (gboolean (*) (GXmlParser*)) gxml_xd_parser_real_current_is_empty_element;
	iface->current_node_name = (gchar* (*) (GXmlParser*)) gxml_xd_parser_real_current_node_name;
	iface->move_next_node = (gboolean (*) (GXmlParser*, GError**)) gxml_xd_parser_real_move_next_node;
	iface->read_child_node = (gboolean (*) (GXmlParser*, GXmlDomNode*, GError**)) gxml_xd_parser_real_read_child_node;
	iface->read_child_nodes_stream = (void (*) (GXmlParser*, GInputStream*, GError**)) gxml_xd_parser_real_read_child_nodes_stream;
	iface->read_element = (void (*) (GXmlParser*, GXmlDomElement*, GError**)) gxml_xd_parser_real_read_element;
	iface->read_stream = (void (*) (GXmlParser*, GInputStream*, GError**)) gxml_xd_parser_real_read_stream;
	iface->read_stream_async = (void (*) (GXmlParser*, GInputStream*, GAsyncReadyCallback, gpointer)) gxml_xd_parser_real_read_stream_async;
	iface->read_stream_finish = (void (*) (GXmlParser*, GAsyncResult*, GError**)) gxml_xd_parser_read_stream_finish;
	iface->read_string = (void (*) (GXmlParser*, const gchar*, GError**)) gxml_xd_parser_real_read_string;
	iface->read_string_async = (void (*) (GXmlParser*, const gchar*, GAsyncReadyCallback, gpointer)) gxml_xd_parser_real_read_string_async;
	iface->read_string_finish = (void (*) (GXmlParser*, GAsyncResult*, GError**)) gxml_xd_parser_read_string_finish;
	iface->read_unparsed = (gchar* (*) (GXmlParser*, GError**)) gxml_xd_parser_real_read_unparsed;
	iface->write_stream = (void (*) (GXmlParser*, GOutputStream*, GError**)) gxml_xd_parser_real_write_stream;
	iface->write_stream_async = (void (*) (GXmlParser*, GOutputStream*, GAsyncReadyCallback, gpointer)) gxml_xd_parser_real_write_stream_async;
	iface->write_stream_finish = (void (*) (GXmlParser*, GAsyncResult*, GError**)) gxml_xd_parser_write_stream_finish;
	iface->write_string = (gchar* (*) (GXmlParser*, GError**)) gxml_xd_parser_real_write_string;
	iface->write_string_async = (void (*) (GXmlParser*, GAsyncReadyCallback, gpointer)) gxml_xd_parser_real_write_string_async;
	iface->write_string_finish = (gchar* (*) (GXmlParser*, GAsyncResult*, GError**)) gxml_xd_parser_write_string_finish;
	iface->get_backup = gxml_xd_parser_real_get_backup;
	iface->set_backup = gxml_xd_parser_real_set_backup;
	iface->get_indent = gxml_xd_parser_real_get_indent;
	iface->set_indent = gxml_xd_parser_real_set_indent;
	iface->get_types = gxml_xd_parser_real_get_types;
	iface->get_node = gxml_xd_parser_real_get_node;
	iface->get_cancellable = gxml_xd_parser_real_get_cancellable;
	iface->set_cancellable = gxml_xd_parser_real_set_cancellable;
}

static void
gxml_xd_parser_instance_init (GXmlXdParser * self,
                              gpointer klass)
{
	self->priv = gxml_xd_parser_get_instance_private (self);
}

static void
gxml_xd_parser_finalize (GObject * obj)
{
	GXmlXdParser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_XD_PARSER, GXmlXdParser);
	_g_object_unref0 (self->priv->document);
	_g_object_unref0 (self->priv->_node);
	_g_hash_table_unref0 (self->priv->_types);
	_g_object_unref0 (self->priv->_cancellable);
	G_OBJECT_CLASS (gxml_xd_parser_parent_class)->finalize (obj);
}

/**
 * Parser implementation of {@link Parser} to parse {@link XDocument}
 * documents.
 */
static GType
gxml_xd_parser_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlXdParserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_xd_parser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlXdParser), 0, (GInstanceInitFunc) gxml_xd_parser_instance_init, NULL };
	static const GInterfaceInfo gxml_parser_info = { (GInterfaceInitFunc) gxml_xd_parser_gxml_parser_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_xd_parser_type_id;
	gxml_xd_parser_type_id = g_type_register_static (G_TYPE_OBJECT, "GXmlXdParser", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_xd_parser_type_id, GXML_TYPE_PARSER, &gxml_parser_info);
	GXmlXdParser_private_offset = g_type_add_instance_private (gxml_xd_parser_type_id, sizeof (GXmlXdParserPrivate));
	return gxml_xd_parser_type_id;
}

GType
gxml_xd_parser_get_type (void)
{
	static volatile gsize gxml_xd_parser_type_id__once = 0;
	if (g_once_init_enter (&gxml_xd_parser_type_id__once)) {
		GType gxml_xd_parser_type_id;
		gxml_xd_parser_type_id = gxml_xd_parser_get_type_once ();
		g_once_init_leave (&gxml_xd_parser_type_id__once, gxml_xd_parser_type_id);
	}
	return gxml_xd_parser_type_id__once;
}

static void
_vala_gxml_xd_parser_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	GXmlXdParser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_XD_PARSER, GXmlXdParser);
	switch (property_id) {
		case GXML_XD_PARSER_BACKUP_PROPERTY:
		g_value_set_boolean (value, gxml_parser_get_backup ((GXmlParser*) self));
		break;
		case GXML_XD_PARSER_INDENT_PROPERTY:
		g_value_set_boolean (value, gxml_parser_get_indent ((GXmlParser*) self));
		break;
		case GXML_XD_PARSER_TYPES_PROPERTY:
		g_value_set_boxed (value, gxml_parser_get_types ((GXmlParser*) self));
		break;
		case GXML_XD_PARSER_NODE_PROPERTY:
		g_value_set_object (value, gxml_parser_get_node ((GXmlParser*) self));
		break;
		case GXML_XD_PARSER_CANCELLABLE_PROPERTY:
		g_value_set_object (value, gxml_parser_get_cancellable ((GXmlParser*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gxml_xd_parser_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec)
{
	GXmlXdParser * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_XD_PARSER, GXmlXdParser);
	switch (property_id) {
		case GXML_XD_PARSER_BACKUP_PROPERTY:
		gxml_parser_set_backup ((GXmlParser*) self, g_value_get_boolean (value));
		break;
		case GXML_XD_PARSER_INDENT_PROPERTY:
		gxml_parser_set_indent ((GXmlParser*) self, g_value_get_boolean (value));
		break;
		case GXML_XD_PARSER_CANCELLABLE_PROPERTY:
		gxml_parser_set_cancellable ((GXmlParser*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

