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

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/* Parser.vala
 *
 * Copyright (C) 2016-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 "gxml/gxml.h"
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <glib-object.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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _GxmlParserWriteFileAsyncData GxmlParserWriteFileAsyncData;
typedef struct _GxmlParserReadFileAsyncData GxmlParserReadFileAsyncData;
typedef struct _GxmlParserReadChildNodesAsyncData GxmlParserReadChildNodesAsyncData;
#define _g_param_spec_unref0(var) ((var == NULL) ? NULL : (var = (g_param_spec_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))

/**
 * Parser Error codes for {@link DomNode} parsing objects
 */
struct _GxmlParserWriteFileAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlParser* self;
	GFile* file;
	GFileOutputStream* ostream;
	gboolean _tmp0_;
	gboolean _tmp1_;
	GCancellable* _tmp2_;
	GCancellable* _tmp3_;
	GFileOutputStream* _tmp4_;
	GFileOutputStream* _tmp5_;
	GError* _inner_error0_;
};

struct _GxmlParserReadFileAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlParser* self;
	GFile* file;
	GError* _tmp0_;
	GFileInputStream* _tmp1_;
	GFileInputStream* _tmp2_;
	GError* _inner_error0_;
};

struct _GxmlParserReadChildNodesAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlParser* self;
	GXmlDomNode* parent;
	gboolean cont;
	gboolean _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	GError* _inner_error0_;
};

static void gxml_parser_real_write_file (GXmlParser* self,
                                  GFile* file,
                                  GError** error);
static void gxml_parser_real_write_file_async_data_free (gpointer _data);
static void gxml_parser_real_write_file_async (GXmlParser* self,
                                        GFile* file,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_);
static gboolean gxml_parser_real_write_file_async_co (GxmlParserWriteFileAsyncData* _data_);
static void gxml_parser_write_file_async_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_);
static void gxml_parser_real_read_file (GXmlParser* self,
                                 GFile* file,
                                 GError** error);
static void gxml_parser_real_read_file_async_data_free (gpointer _data);
static void gxml_parser_real_read_file_async (GXmlParser* self,
                                       GFile* file,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
static gboolean gxml_parser_real_read_file_async_co (GxmlParserReadFileAsyncData* _data_);
static gboolean _gxml_parser_real_read_file_async_co_gsource_func (gpointer self);
static void gxml_parser_read_file_async_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_);
static void gxml_parser_real_read_child_nodes (GXmlParser* self,
                                        GXmlDomNode* parent,
                                        GError** error);
static void gxml_parser_real_read_child_nodes_async_data_free (gpointer _data);
static void gxml_parser_real_read_child_nodes_async (GXmlParser* self,
                                              GXmlDomNode* parent,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static gboolean gxml_parser_real_read_child_nodes_async_co (GxmlParserReadChildNodesAsyncData* _data_);
static gboolean _gxml_parser_real_read_child_nodes_async_co_gsource_func (gpointer self);
static gboolean gxml_parser_real_read_child_element (GXmlParser* self,
                                              GXmlDomNode* parent,
                                              GError** error);
static gboolean gxml_parser_real_read_element_property (GXmlParser* self,
                                                 GXmlDomNode* parent,
                                                 GXmlDomNode** element,
                                                 GError** error);
static void _g_param_spec_unref0_ (gpointer var);
static inline void _g_list_free__g_param_spec_unref0_ (GList* self);
static gboolean gxml_parser_real_add_element_collection (GXmlParser* self,
                                                  GXmlDomNode* parent,
                                                  GXmlDomNode** element,
                                                  GError** error);
static void gxml_parser_real_read_child_nodes_string (GXmlParser* self,
                                               const gchar* str,
                                               GError** error);
static guint8* _vala_array_dup3 (guint8* self,
                          gssize length);
static GType gxml_parser_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

GQuark
gxml_parser_error_quark (void)
{
	return g_quark_from_static_string ("gxml-parser-error-quark");
}

static GType
gxml_parser_error_get_type_once (void)
{
	static const GEnumValue values[] = {{GXML_PARSER_ERROR_INVALID_DATA_ERROR, "GXML_PARSER_ERROR_INVALID_DATA_ERROR", "invalid-data-error"}, {GXML_PARSER_ERROR_INVALID_FILE_ERROR, "GXML_PARSER_ERROR_INVALID_FILE_ERROR", "invalid-file-error"}, {GXML_PARSER_ERROR_INVALID_STREAM_ERROR, "GXML_PARSER_ERROR_INVALID_STREAM_ERROR", "invalid-stream-error"}, {0, NULL, NULL}};
	GType gxml_parser_error_type_id;
	gxml_parser_error_type_id = g_enum_register_static ("GXmlParserError", values);
	return gxml_parser_error_type_id;
}

GType
gxml_parser_error_get_type (void)
{
	static volatile gsize gxml_parser_error_type_id__once = 0;
	if (g_once_init_enter (&gxml_parser_error_type_id__once)) {
		GType gxml_parser_error_type_id;
		gxml_parser_error_type_id = gxml_parser_error_get_type_once ();
		g_once_init_leave (&gxml_parser_error_type_id__once, gxml_parser_error_type_id);
	}
	return gxml_parser_error_type_id__once;
}

gboolean
gxml_parser_get_backup (GXmlParser* self)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->get_backup) {
		return _iface_->get_backup (self);
	}
	return FALSE;
}

void
gxml_parser_set_backup (GXmlParser* self,
                        gboolean value)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->set_backup) {
		_iface_->set_backup (self, value);
	}
}

gboolean
gxml_parser_get_indent (GXmlParser* self)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->get_indent) {
		return _iface_->get_indent (self);
	}
	return FALSE;
}

void
gxml_parser_set_indent (GXmlParser* self,
                        gboolean value)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->set_indent) {
		_iface_->set_indent (self, value);
	}
}

GCancellable*
gxml_parser_get_cancellable (GXmlParser* self)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->get_cancellable) {
		return _iface_->get_cancellable (self);
	}
	return NULL;
}

void
gxml_parser_set_cancellable (GXmlParser* self,
                             GCancellable* value)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->set_cancellable) {
		_iface_->set_cancellable (self, value);
	}
}

GXmlDomNode*
gxml_parser_get_node (GXmlParser* self)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->get_node) {
		return _iface_->get_node (self);
	}
	return NULL;
}

GHashTable*
gxml_parser_get_types (GXmlParser* self)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->get_types) {
		return _iface_->get_types (self);
	}
	return NULL;
}

/**
   * Writes a {@link GXml.DomDocument} to a {@link GLib.File}
   */
static void
gxml_parser_real_write_file (GXmlParser* self,
                             GFile* file,
                             GError** error)
{
	GFileOutputStream* ostream = NULL;
	gboolean _tmp0_;
	gboolean _tmp1_;
	GCancellable* _tmp2_;
	GCancellable* _tmp3_;
	GFileOutputStream* _tmp4_;
	GFileOutputStream* _tmp5_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (file != NULL);
	_tmp0_ = gxml_parser_get_backup (self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gxml_parser_get_cancellable (self);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_file_replace (file, NULL, _tmp1_, G_FILE_CREATE_NONE, _tmp3_, &_inner_error0_);
	ostream = _tmp4_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp5_ = ostream;
	gxml_parser_write_stream (self, (GOutputStream*) _tmp5_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (ostream);
		return;
	}
	_g_object_unref0 (ostream);
}

void
gxml_parser_write_file (GXmlParser* self,
                        GFile* file,
                        GError** error)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->write_file) {
		_iface_->write_file (self, file, error);
	}
}

static void
gxml_parser_real_write_file_async_data_free (gpointer _data)
{
	GxmlParserWriteFileAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlParserWriteFileAsyncData, _data_);
}

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

static void
gxml_parser_real_write_file_async (GXmlParser* self,
                                   GFile* file,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	GxmlParserWriteFileAsyncData* _data_;
	GXmlParser* _tmp0_;
	GFile* _tmp1_;
	g_return_if_fail (file != NULL);
	_data_ = g_slice_new0 (GxmlParserWriteFileAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_parser_real_write_file_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (file);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp1_;
	gxml_parser_real_write_file_async_co (_data_);
}

static void
gxml_parser_real_write_file_finish (GXmlParser* self,
                                    GAsyncResult* _res_,
                                    GError** error)
{
	GxmlParserWriteFileAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Writes a {@link GXml.DomDocument} to a {@link GLib.File}
   */
static void
gxml_parser_write_file_async_ready (GObject* source_object,
                                    GAsyncResult* _res_,
                                    gpointer _user_data_)
{
	GxmlParserWriteFileAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_parser_real_write_file_async_co (_data_);
}

static gboolean
gxml_parser_real_write_file_async_co (GxmlParserWriteFileAsyncData* _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_->_tmp0_ = gxml_parser_get_backup (_data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = gxml_parser_get_cancellable (_data_->self);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_state_ = 1;
	g_file_replace_async (_data_->file, NULL, _data_->_tmp1_, G_FILE_CREATE_NONE, 0, _data_->_tmp3_, gxml_parser_write_file_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp4_ = g_file_replace_finish (_data_->file, _data_->_res_, &_data_->_inner_error0_);
	_data_->ostream = _data_->_tmp4_;
	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_->_tmp5_ = _data_->ostream;
	_data_->_state_ = 2;
	gxml_parser_write_stream_async (_data_->self, (GOutputStream*) _data_->_tmp5_, gxml_parser_write_file_async_ready, _data_);
	return FALSE;
	_state_2:
	gxml_parser_write_stream_finish (_data_->self, _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_->ostream);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->ostream);
	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;
}

void
gxml_parser_write_file_async (GXmlParser* self,
                              GFile* file,
                              GAsyncReadyCallback _callback_,
                              gpointer _user_data_)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->write_file_async) {
		_iface_->write_file_async (self, file, _callback_, _user_data_);
	}
}

void
gxml_parser_write_file_finish (GXmlParser* self,
                               GAsyncResult* _res_,
                               GError** error)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->write_file_finish) {
		_iface_->write_file_finish (self, _res_, error);
	}
}

/**
   * Writes a {@link node} to a string
   */
gchar*
gxml_parser_write_string (GXmlParser* self,
                          GError** error)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->write_string) {
		return _iface_->write_string (self, error);
	}
	return NULL;
}

void
gxml_parser_write_string_async (GXmlParser* self,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->write_string_async) {
		_iface_->write_string_async (self, _callback_, _user_data_);
	}
}

gchar*
gxml_parser_write_string_finish (GXmlParser* self,
                                 GAsyncResult* _res_,
                                 GError** error)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->write_string_finish) {
		return _iface_->write_string_finish (self, _res_, error);
	}
	return NULL;
}

/**
   * Writes a {@link GXml.DomDocument} to a {@link GLib.OutputStream}
   */
void
gxml_parser_write_stream (GXmlParser* self,
                          GOutputStream* stream,
                          GError** error)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->write_stream) {
		_iface_->write_stream (self, stream, error);
	}
}

void
gxml_parser_write_stream_async (GXmlParser* self,
                                GOutputStream* stream,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->write_stream_async) {
		_iface_->write_stream_async (self, stream, _callback_, _user_data_);
	}
}

void
gxml_parser_write_stream_finish (GXmlParser* self,
                                 GAsyncResult* _res_,
                                 GError** error)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->write_stream_finish) {
		_iface_->write_stream_finish (self, _res_, error);
	}
}

/**
   * Reads a {@link node} from a {@link GLib.File}
   */
static void
gxml_parser_real_read_file (GXmlParser* self,
                            GFile* file,
                            GError** error)
{
	GFileInputStream* _tmp1_ = NULL;
	GFileInputStream* _tmp2_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (file != NULL);
	if (!g_file_query_exists (file, NULL)) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GXML_PARSER_ERROR, GXML_PARSER_ERROR_INVALID_FILE_ERROR, _ ("File doesn't exist"));
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp2_ = g_file_read (file, NULL, &_inner_error0_);
	_tmp1_ = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
	gxml_parser_read_stream (self, (GInputStream*) _tmp1_, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (_tmp1_);
		return;
	}
	_g_object_unref0 (_tmp1_);
}

void
gxml_parser_read_file (GXmlParser* self,
                       GFile* file,
                       GError** error)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_file) {
		_iface_->read_file (self, file, error);
	}
}

static void
gxml_parser_real_read_file_async_data_free (gpointer _data)
{
	GxmlParserReadFileAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlParserReadFileAsyncData, _data_);
}

static void
gxml_parser_real_read_file_async (GXmlParser* self,
                                  GFile* file,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_)
{
	GxmlParserReadFileAsyncData* _data_;
	GXmlParser* _tmp0_;
	GFile* _tmp1_;
	g_return_if_fail (file != NULL);
	_data_ = g_slice_new0 (GxmlParserReadFileAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_parser_real_read_file_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (file);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp1_;
	gxml_parser_real_read_file_async_co (_data_);
}

static void
gxml_parser_real_read_file_finish (GXmlParser* self,
                                   GAsyncResult* _res_,
                                   GError** error)
{
	GxmlParserReadFileAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Reads a {@link GXml.DomDocument} from a {@link GLib.File}
   */
static gboolean
_gxml_parser_real_read_file_async_co_gsource_func (gpointer self)
{
	gboolean result;
	result = gxml_parser_real_read_file_async_co (self);
	return result;
}

static void
gxml_parser_read_file_async_ready (GObject* source_object,
                                   GAsyncResult* _res_,
                                   gpointer _user_data_)
{
	GxmlParserReadFileAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_parser_real_read_file_async_co (_data_);
}

static gboolean
gxml_parser_real_read_file_async_co (GxmlParserReadFileAsyncData* _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:
	if (!g_file_query_exists (_data_->file, NULL)) {
		_data_->_tmp0_ = g_error_new_literal (GXML_PARSER_ERROR, GXML_PARSER_ERROR_INVALID_FILE_ERROR, _ ("File doesn't exist"));
		_data_->_inner_error0_ = _data_->_tmp0_;
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _gxml_parser_real_read_file_async_co_gsource_func, _data_, NULL);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp2_ = g_file_read (_data_->file, NULL, &_data_->_inner_error0_);
	_data_->_tmp1_ = _data_->_tmp2_;
	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_->_state_ = 2;
	gxml_parser_read_stream_async (_data_->self, (GInputStream*) _data_->_tmp1_, gxml_parser_read_file_async_ready, _data_);
	return FALSE;
	_state_2:
	gxml_parser_read_stream_finish (_data_->self, _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_->_tmp1_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->_tmp1_);
	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;
}

void
gxml_parser_read_file_async (GXmlParser* self,
                             GFile* file,
                             GAsyncReadyCallback _callback_,
                             gpointer _user_data_)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_file_async) {
		_iface_->read_file_async (self, file, _callback_, _user_data_);
	}
}

void
gxml_parser_read_file_finish (GXmlParser* self,
                              GAsyncResult* _res_,
                              GError** error)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_file_finish) {
		_iface_->read_file_finish (self, _res_, error);
	}
}

/**
   * Read a {@link GXml.DomDocument} from a {@link GLib.InputStream}
   */
void
gxml_parser_read_stream (GXmlParser* self,
                         GInputStream* stream,
                         GError** error)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_stream) {
		_iface_->read_stream (self, stream, error);
	}
}

void
gxml_parser_read_stream_async (GXmlParser* self,
                               GInputStream* stream,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_stream_async) {
		_iface_->read_stream_async (self, stream, _callback_, _user_data_);
	}
}

void
gxml_parser_read_stream_finish (GXmlParser* self,
                                GAsyncResult* _res_,
                                GError** error)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_stream_finish) {
		_iface_->read_stream_finish (self, _res_, error);
	}
}

/**
   * Reads a {@link node} from a string
   */
void
gxml_parser_read_string (GXmlParser* self,
                         const gchar* str,
                         GError** error)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_string) {
		_iface_->read_string (self, str, error);
	}
}

void
gxml_parser_read_string_async (GXmlParser* self,
                               const gchar* str,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_string_async) {
		_iface_->read_string_async (self, str, _callback_, _user_data_);
	}
}

void
gxml_parser_read_string_finish (GXmlParser* self,
                                GAsyncResult* _res_,
                                GError** error)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_string_finish) {
		_iface_->read_string_finish (self, _res_, error);
	}
}

/**
   * Creates an {@link GLib.InputStream} to write a string representation
   * in XML
   */
GInputStream*
gxml_parser_create_stream (GXmlParser* self,
                           GError** error)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->create_stream) {
		return _iface_->create_stream (self, error);
	}
	return NULL;
}

void
gxml_parser_create_stream_async (GXmlParser* self,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->create_stream_async) {
		_iface_->create_stream_async (self, _callback_, _user_data_);
	}
}

GInputStream*
gxml_parser_create_stream_finish (GXmlParser* self,
                                  GAsyncResult* _res_,
                                  GError** error)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->create_stream_finish) {
		return _iface_->create_stream_finish (self, _res_, error);
	}
	return NULL;
}

/**
   * Iterates in all child nodes and append them to node.
   */
static void
gxml_parser_real_read_child_nodes (GXmlParser* self,
                                   GXmlDomNode* parent,
                                   GError** error)
{
	gboolean cont = FALSE;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (parent != NULL);
	cont = TRUE;
	while (TRUE) {
		gboolean _tmp1_ = FALSE;
		if (!cont) {
			break;
		}
		if (GXML_IS_DOM_DOCUMENT (parent)) {
			gboolean _tmp0_ = FALSE;
			_tmp0_ = gxml_parser_read_child_node (self, parent, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_propagate_error (error, _inner_error0_);
				return;
			}
			cont = _tmp0_;
		}
		_tmp1_ = gxml_parser_move_next_node (self, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			return;
		}
		if (!_tmp1_) {
			return;
		}
		if (gxml_parser_current_is_element (self)) {
			gboolean _tmp2_ = FALSE;
			_tmp2_ = gxml_parser_read_child_element (self, parent, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_propagate_error (error, _inner_error0_);
				return;
			}
			cont = _tmp2_;
		} else {
			gboolean _tmp3_ = FALSE;
			_tmp3_ = gxml_parser_read_child_node (self, parent, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_propagate_error (error, _inner_error0_);
				return;
			}
			cont = _tmp3_;
		}
	}
}

void
gxml_parser_read_child_nodes (GXmlParser* self,
                              GXmlDomNode* parent,
                              GError** error)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_child_nodes) {
		_iface_->read_child_nodes (self, parent, error);
	}
}

static void
gxml_parser_real_read_child_nodes_async_data_free (gpointer _data)
{
	GxmlParserReadChildNodesAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->parent);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlParserReadChildNodesAsyncData, _data_);
}

static void
gxml_parser_real_read_child_nodes_async (GXmlParser* self,
                                         GXmlDomNode* parent,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	GxmlParserReadChildNodesAsyncData* _data_;
	GXmlParser* _tmp0_;
	GXmlDomNode* _tmp1_;
	g_return_if_fail (parent != NULL);
	_data_ = g_slice_new0 (GxmlParserReadChildNodesAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_parser_real_read_child_nodes_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (parent);
	_g_object_unref0 (_data_->parent);
	_data_->parent = _tmp1_;
	gxml_parser_real_read_child_nodes_async_co (_data_);
}

static void
gxml_parser_real_read_child_nodes_finish (GXmlParser* self,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	GxmlParserReadChildNodesAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Iterates in all child nodes and append them to node.
   */
static gboolean
_gxml_parser_real_read_child_nodes_async_co_gsource_func (gpointer self)
{
	gboolean result;
	result = gxml_parser_real_read_child_nodes_async_co (self);
	return result;
}

static gboolean
gxml_parser_real_read_child_nodes_async_co (GxmlParserReadChildNodesAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->cont = TRUE;
	while (TRUE) {
		if (!_data_->cont) {
			break;
		}
		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _gxml_parser_real_read_child_nodes_async_co_gsource_func, _data_, NULL);
		_data_->_state_ = 1;
		return FALSE;
		_state_1:
		;
		_data_->_tmp0_ = gxml_parser_move_next_node (_data_->self, &_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;
		}
		if (!_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;
		}
		if (gxml_parser_current_is_element (_data_->self)) {
			_data_->_tmp1_ = gxml_parser_read_child_element (_data_->self, _data_->parent, &_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;
			}
			_data_->cont = _data_->_tmp1_;
		} else {
			_data_->_tmp2_ = gxml_parser_read_child_node (_data_->self, _data_->parent, &_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;
			}
			_data_->cont = _data_->_tmp2_;
		}
	}
	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;
}

void
gxml_parser_read_child_nodes_async (GXmlParser* self,
                                    GXmlDomNode* parent,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_child_nodes_async) {
		_iface_->read_child_nodes_async (self, parent, _callback_, _user_data_);
	}
}

void
gxml_parser_read_child_nodes_finish (GXmlParser* self,
                                     GAsyncResult* _res_,
                                     GError** error)
{
	GXmlParserIface* _iface_;
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_child_nodes_finish) {
		_iface_->read_child_nodes_finish (self, _res_, error);
	}
}

/**
   * Creates a new {@link DomNode} and append it to
   * parent: depending on current node's type found by parser.
   *
   * If current found node is a {@link DomElement}, it is not parsed.
   * If you want to parse it use {@link read_element} method.
   *
   * Returns: true if node has been created and appended to parent.
   */
gboolean
gxml_parser_read_child_node (GXmlParser* self,
                             GXmlDomNode* parent,
                             GError** error)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_child_node) {
		return _iface_->read_child_node (self, parent, error);
	}
	return FALSE;
}

/**
   * Reads current found element
   */
static gboolean
gxml_parser_real_read_child_element (GXmlParser* self,
                                     GXmlDomNode* parent,
                                     GError** error)
{
	gboolean isempty = FALSE;
	GXmlDomNode* n = NULL;
	gboolean _tmp2_ = FALSE;
	GXmlDomNode* _tmp3_ = NULL;
	gboolean _tmp4_;
	GXmlDomNode* _tmp16_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (parent != NULL, FALSE);
	if (!gxml_parser_current_is_element (self)) {
		GError* _tmp0_;
		gboolean _tmp1_ = FALSE;
		_tmp0_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Invalid attempt to parse an element node, when current found node is n" \
"ot"));
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return _tmp1_;
	}
	isempty = gxml_parser_current_is_empty_element (self);
	n = NULL;
	_tmp4_ = gxml_parser_read_element_property (self, parent, &_tmp3_, &_inner_error0_);
	_g_object_unref0 (n);
	n = _tmp3_;
	_tmp2_ = _tmp4_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp5_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (n);
		return _tmp5_;
	}
	if (!_tmp2_) {
		gboolean _tmp6_ = FALSE;
		GXmlDomNode* _tmp7_ = NULL;
		gboolean _tmp8_;
		_tmp8_ = gxml_parser_add_element_collection (self, parent, &_tmp7_, &_inner_error0_);
		_g_object_unref0 (n);
		n = _tmp7_;
		_tmp6_ = _tmp8_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp9_ = FALSE;
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (n);
			return _tmp9_;
		}
		if (!_tmp6_) {
			GXmlDomElement* _tmp10_ = NULL;
			GXmlDomElement* _tmp11_;
			GXmlDomElement* _tmp13_;
			GXmlDomNode* _tmp14_;
			_tmp11_ = gxml_parser_create_element (self, parent, &_inner_error0_);
			_tmp10_ = _tmp11_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				gboolean _tmp12_ = FALSE;
				g_propagate_error (error, _inner_error0_);
				_g_object_unref0 (n);
				return _tmp12_;
			}
			_tmp13_ = _tmp10_;
			_tmp10_ = NULL;
			_g_object_unref0 (n);
			n = (GXmlDomNode*) _tmp13_;
			_tmp14_ = n;
			gxml_parser_read_element (self, GXML_IS_DOM_ELEMENT (_tmp14_) ? ((GXmlDomElement*) _tmp14_) : NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				gboolean _tmp15_ = FALSE;
				g_propagate_error (error, _inner_error0_);
				_g_object_unref0 (_tmp10_);
				_g_object_unref0 (n);
				return _tmp15_;
			}
			_g_object_unref0 (_tmp10_);
		}
	}
	_tmp16_ = n;
	if (_tmp16_ == NULL) {
		result = FALSE;
		_g_object_unref0 (n);
		return result;
	}
	if (!isempty) {
		GXmlDomNode* _tmp17_;
		_tmp17_ = n;
		gxml_parser_read_child_nodes (self, _tmp17_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp18_ = FALSE;
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (n);
			return _tmp18_;
		}
	}
	result = TRUE;
	_g_object_unref0 (n);
	return result;
}

gboolean
gxml_parser_read_child_element (GXmlParser* self,
                                GXmlDomNode* parent,
                                GError** error)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_child_element) {
		return _iface_->read_child_element (self, parent, error);
	}
	return FALSE;
}

/**
   * Creates a new {@link DomElement} and append it as a child of parent: for current
   * read node, only if parent: have a property as {@link DomElement} type and current
   * node have same local name as property element.
   *
   * Returns: true if element is set to a new object and it is set as a child of parent:
   * as a property.
   */
static gpointer
_g_param_spec_ref0 (gpointer self)
{
	return self ? g_param_spec_ref (self) : NULL;
}

static void
_g_param_spec_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_param_spec_unref (var), NULL));
}

static inline void
_g_list_free__g_param_spec_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_param_spec_unref0_);
}

static gboolean
gxml_parser_real_read_element_property (GXmlParser* self,
                                        GXmlDomNode* parent,
                                        GXmlDomNode** element,
                                        GError** error)
{
	GXmlDomNode* _vala_element = NULL;
	GList* _tmp0_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (parent != NULL, FALSE);
	_g_object_unref0 (_vala_element);
	_vala_element = NULL;
	if (!GXML_IS_OBJECT (parent)) {
		result = FALSE;
		if (element) {
			*element = _vala_element;
		} else {
			_g_object_unref0 (_vala_element);
		}
		return result;
	}
	_tmp0_ = gxml_object_get_property_element_list (G_TYPE_CHECK_INSTANCE_CAST (parent, GXML_TYPE_OBJECT, GXmlObject));
	{
		GList* pspec_collection = NULL;
		GList* pspec_it = NULL;
		pspec_collection = _tmp0_;
		for (pspec_it = pspec_collection; pspec_it != NULL; pspec_it = pspec_it->next) {
			GParamSpec* _tmp1_;
			GParamSpec* pspec = NULL;
			_tmp1_ = _g_param_spec_ref0 ((GParamSpec*) pspec_it->data);
			pspec = _tmp1_;
			{
				GParamSpec* _tmp2_;
				GXmlDomElement* obj = NULL;
				GParamSpec* _tmp3_;
				GXmlDomNode* _tmp4_;
				GXmlDomNode* _tmp5_;
				GXmlDomDocument* _tmp6_;
				GXmlDomDocument* _tmp7_;
				GObject* _tmp8_;
				GObject* _tmp9_;
				GXmlDomElement* _tmp10_;
				GXmlDomElement* _tmp11_;
				gchar* _tmp12_;
				gchar* _tmp13_;
				gchar* _tmp14_;
				gchar* _tmp15_;
				gchar* _tmp16_;
				gchar* _tmp17_;
				gchar* _tmp18_;
				gchar* _tmp19_;
				gchar* _tmp20_;
				gboolean _tmp21_;
				_tmp2_ = pspec;
				if (g_type_is_a (_tmp2_->value_type, GXML_TYPE_COLLECTION)) {
					_g_param_spec_unref0 (pspec);
					continue;
				}
				_tmp3_ = pspec;
				_tmp4_ = gxml_parser_get_node (self);
				_tmp5_ = _tmp4_;
				_tmp6_ = gxml_dom_node_get_owner_document (_tmp5_);
				_tmp7_ = _tmp6_;
				_tmp8_ = g_object_new (_tmp3_->value_type, "owner-document", _tmp7_, NULL);
				_tmp9_ = G_IS_INITIALLY_UNOWNED (_tmp8_) ? g_object_ref_sink (_tmp8_) : _tmp8_;
				_tmp10_ = GXML_IS_DOM_ELEMENT (_tmp9_) ? ((GXmlDomElement*) _tmp9_) : NULL;
				if (_tmp10_ == NULL) {
					_g_object_unref0 (_tmp9_);
				}
				obj = _tmp10_;
				_tmp11_ = obj;
				_tmp12_ = gxml_dom_element_get_local_name (_tmp11_);
				_tmp13_ = _tmp12_;
				_tmp14_ = _tmp13_;
				_tmp15_ = g_utf8_strdown (_tmp14_, (gssize) -1);
				_tmp16_ = _tmp15_;
				_tmp17_ = gxml_parser_current_node_name (self);
				_tmp18_ = _tmp17_;
				_tmp19_ = g_utf8_strdown (_tmp18_, (gssize) -1);
				_tmp20_ = _tmp19_;
				_tmp21_ = g_strcmp0 (_tmp16_, _tmp20_) == 0;
				_g_free0 (_tmp20_);
				_g_free0 (_tmp18_);
				_g_free0 (_tmp16_);
				_g_free0 (_tmp14_);
				if (_tmp21_) {
					GValue v = {0};
					GParamSpec* _tmp22_;
					GValue _tmp23_ = {0};
					GXmlDomElement* _tmp24_;
					GXmlDomNode* _tmp25_;
					GXmlDomNode* _tmp26_;
					GXmlDomElement* _tmp28_;
					GParamSpec* _tmp29_;
					const gchar* _tmp30_;
					GValue _tmp31_;
					GXmlDomElement* _tmp32_;
					GXmlDomElement* _tmp34_;
					GXmlDomNode* _tmp35_;
					_tmp22_ = pspec;
					g_value_init (&_tmp23_, _tmp22_->value_type);
					v = _tmp23_;
					_tmp24_ = obj;
					_tmp25_ = gxml_dom_node_append_child (parent, GXML_IS_DOM_NODE (_tmp24_) ? ((GXmlDomNode*) _tmp24_) : NULL, &_inner_error0_);
					_tmp26_ = _tmp25_;
					_g_object_unref0 (_tmp26_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						gboolean _tmp27_ = FALSE;
						g_propagate_error (error, _inner_error0_);
						G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
						_g_object_unref0 (obj);
						_g_param_spec_unref0 (pspec);
						(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
						_g_object_unref0 (_vala_element);
						return _tmp27_;
					}
					_tmp28_ = obj;
					g_value_set_object (&v, (GObject*) _tmp28_);
					_tmp29_ = pspec;
					_tmp30_ = _tmp29_->name;
					_tmp31_ = v;
					g_object_set_property ((GObject*) parent, _tmp30_, &_tmp31_);
					_tmp32_ = obj;
					gxml_parser_read_element (self, GXML_IS_DOM_ELEMENT (_tmp32_) ? ((GXmlDomElement*) _tmp32_) : NULL, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						gboolean _tmp33_ = FALSE;
						g_propagate_error (error, _inner_error0_);
						G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
						_g_object_unref0 (obj);
						_g_param_spec_unref0 (pspec);
						(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
						_g_object_unref0 (_vala_element);
						return _tmp33_;
					}
					_tmp34_ = obj;
					_tmp35_ = _g_object_ref0 (GXML_IS_DOM_NODE (_tmp34_) ? ((GXmlDomNode*) _tmp34_) : NULL);
					_g_object_unref0 (_vala_element);
					_vala_element = _tmp35_;
					result = TRUE;
					G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
					_g_object_unref0 (obj);
					_g_param_spec_unref0 (pspec);
					(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
					if (element) {
						*element = _vala_element;
					} else {
						_g_object_unref0 (_vala_element);
					}
					return result;
				}
				_g_object_unref0 (obj);
				_g_param_spec_unref0 (pspec);
			}
		}
		(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
	}
	result = FALSE;
	if (element) {
		*element = _vala_element;
	} else {
		_g_object_unref0 (_vala_element);
	}
	return result;
}

gboolean
gxml_parser_read_element_property (GXmlParser* self,
                                   GXmlDomNode* parent,
                                   GXmlDomNode** element,
                                   GError** error)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_element_property) {
		return _iface_->read_element_property (self, parent, element, error);
	}
	return FALSE;
}

/**
   * Creates a new {@link DomElement} and append it as a child of parent: for current
   * read node, only if parent: have a property as {@link Collection} type and current
   * node have same local name as collection {@link Collection.items_name}
   *
   * Returns: true if element is set to a new object, it is set as a child of parent:
   * and has been added to a parent:'s collection property.
   */
static gpointer
_g_hash_table_ref0 (gpointer self)
{
	return self ? g_hash_table_ref (self) : NULL;
}

static gboolean
gxml_parser_real_add_element_collection (GXmlParser* self,
                                         GXmlDomNode* parent,
                                         GXmlDomNode** element,
                                         GError** error)
{
	GXmlDomNode* _vala_element = NULL;
	GList* _tmp0_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (parent != NULL, FALSE);
	_g_object_unref0 (_vala_element);
	_vala_element = NULL;
	if (!GXML_IS_OBJECT (parent)) {
		result = FALSE;
		if (element) {
			*element = _vala_element;
		} else {
			_g_object_unref0 (_vala_element);
		}
		return result;
	}
	_tmp0_ = gxml_object_get_property_element_list (G_TYPE_CHECK_INSTANCE_CAST (parent, GXML_TYPE_OBJECT, GXmlObject));
	{
		GList* pspec_collection = NULL;
		GList* pspec_it = NULL;
		pspec_collection = _tmp0_;
		for (pspec_it = pspec_collection; pspec_it != NULL; pspec_it = pspec_it->next) {
			GParamSpec* _tmp1_;
			GParamSpec* pspec = NULL;
			_tmp1_ = _g_param_spec_ref0 ((GParamSpec*) pspec_it->data);
			pspec = _tmp1_;
			{
				GParamSpec* _tmp2_;
				GXmlCollection* col = NULL;
				GValue vc = {0};
				GParamSpec* _tmp3_;
				GValue _tmp4_ = {0};
				GParamSpec* _tmp5_;
				const gchar* _tmp6_;
				GObject* _tmp7_;
				GXmlCollection* _tmp8_;
				GXmlCollection* _tmp9_;
				gboolean _tmp18_ = FALSE;
				GXmlCollection* _tmp19_;
				GType _tmp20_;
				GType _tmp21_;
				GType obj_type = G_TYPE_NONE;
				GXmlCollection* _tmp29_;
				_tmp2_ = pspec;
				if (!g_type_is_a (_tmp2_->value_type, GXML_TYPE_COLLECTION)) {
					_g_param_spec_unref0 (pspec);
					continue;
				}
				_tmp3_ = pspec;
				g_value_init (&_tmp4_, _tmp3_->value_type);
				vc = _tmp4_;
				_tmp5_ = pspec;
				_tmp6_ = _tmp5_->name;
				g_object_get_property ((GObject*) parent, _tmp6_, &vc);
				_tmp7_ = g_value_get_object (&vc);
				_tmp8_ = _g_object_ref0 (GXML_IS_COLLECTION (_tmp7_) ? ((GXmlCollection*) _tmp7_) : NULL);
				_g_object_unref0 (col);
				col = _tmp8_;
				_tmp9_ = col;
				if (_tmp9_ == NULL) {
					GParamSpec* _tmp10_;
					GObject* _tmp11_;
					GObject* _tmp12_;
					GXmlCollection* _tmp13_;
					GXmlCollection* _tmp14_;
					GParamSpec* _tmp15_;
					const gchar* _tmp16_;
					GValue _tmp17_;
					_tmp10_ = pspec;
					_tmp11_ = g_object_new (_tmp10_->value_type, "element", parent, NULL);
					_tmp12_ = G_IS_INITIALLY_UNOWNED (_tmp11_) ? g_object_ref_sink (_tmp11_) : _tmp11_;
					_tmp13_ = GXML_IS_COLLECTION (_tmp12_) ? ((GXmlCollection*) _tmp12_) : NULL;
					if (_tmp13_ == NULL) {
						_g_object_unref0 (_tmp12_);
					}
					_g_object_unref0 (col);
					col = _tmp13_;
					_tmp14_ = col;
					g_value_set_object (&vc, (GObject*) _tmp14_);
					_tmp15_ = pspec;
					_tmp16_ = _tmp15_->name;
					_tmp17_ = vc;
					g_object_set_property ((GObject*) parent, _tmp16_, &_tmp17_);
				}
				_tmp19_ = col;
				_tmp20_ = gxml_collection_get_items_type (_tmp19_);
				_tmp21_ = _tmp20_;
				if (_tmp21_ == G_TYPE_INVALID) {
					_tmp18_ = TRUE;
				} else {
					GXmlCollection* _tmp22_;
					GType _tmp23_;
					GType _tmp24_;
					_tmp22_ = col;
					_tmp23_ = gxml_collection_get_items_type (_tmp22_);
					_tmp24_ = _tmp23_;
					_tmp18_ = !g_type_is_a (_tmp24_, GXML_TYPE_OBJECT);
				}
				if (_tmp18_) {
					GXmlCollection* _tmp25_;
					const gchar* _tmp26_;
					GError* _tmp27_;
					gboolean _tmp28_ = FALSE;
					_tmp25_ = col;
					_tmp26_ = g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) _tmp25_));
					_tmp27_ = g_error_new (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Collection '%s' hasn't been constructed properly: items' type property" \
" was not set at construction time or set to invalid type"), _tmp26_);
					_inner_error0_ = _tmp27_;
					g_propagate_error (error, _inner_error0_);
					G_IS_VALUE (&vc) ? (g_value_unset (&vc), NULL) : NULL;
					_g_object_unref0 (col);
					_g_param_spec_unref0 (pspec);
					(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
					_g_object_unref0 (_vala_element);
					return _tmp28_;
				}
				obj_type = G_TYPE_INVALID;
				_tmp29_ = col;
				if (GXML_IS_COLLECTION_PARENT (_tmp29_)) {
					GHashTable* obj_types = NULL;
					GHashTable* _tmp30_;
					GHashTable* _tmp31_;
					GXmlCollection* _tmp32_;
					GHashTable* _tmp46_;
					obj_types = NULL;
					_tmp30_ = gxml_parser_get_types (self);
					_tmp31_ = _tmp30_;
					_tmp32_ = col;
					if (!g_hash_table_contains (_tmp31_, (gpointer) ((gintptr) G_TYPE_FROM_INSTANCE ((GObject*) _tmp32_)))) {
						GXmlCollection* _tmp33_;
						GHashTable* _tmp34_;
						GHashTable* _tmp35_;
						GHashTable* _tmp36_;
						GHashTable* _tmp37_;
						GXmlCollection* _tmp38_;
						GHashTable* _tmp39_;
						GHashTable* _tmp40_;
						_tmp33_ = col;
						_tmp34_ = gxml_collection_parent_get_types (G_TYPE_CHECK_INSTANCE_CAST (_tmp33_, GXML_TYPE_COLLECTION_PARENT, GXmlCollectionParent));
						_tmp35_ = _tmp34_;
						_g_hash_table_unref0 (obj_types);
						obj_types = _tmp35_;
						_tmp36_ = gxml_parser_get_types (self);
						_tmp37_ = _tmp36_;
						_tmp38_ = col;
						_tmp39_ = obj_types;
						_tmp40_ = _g_hash_table_ref0 (_tmp39_);
						g_hash_table_insert (_tmp37_, (gpointer) ((gintptr) G_TYPE_FROM_INSTANCE ((GObject*) _tmp38_)), _tmp40_);
					} else {
						GHashTable* _tmp41_;
						GHashTable* _tmp42_;
						GXmlCollection* _tmp43_;
						gconstpointer _tmp44_;
						GHashTable* _tmp45_;
						_tmp41_ = gxml_parser_get_types (self);
						_tmp42_ = _tmp41_;
						_tmp43_ = col;
						_tmp44_ = g_hash_table_lookup (_tmp42_, (gpointer) ((gintptr) G_TYPE_FROM_INSTANCE ((GObject*) _tmp43_)));
						_tmp45_ = _g_hash_table_ref0 ((GHashTable*) _tmp44_);
						_g_hash_table_unref0 (obj_types);
						obj_types = _tmp45_;
					}
					_tmp46_ = obj_types;
					if (_tmp46_ != NULL) {
						gchar* n = NULL;
						gchar* _tmp47_;
						gchar* _tmp48_;
						gchar* _tmp49_;
						gchar* _tmp50_;
						GHashTable* _tmp51_;
						const gchar* _tmp52_;
						_tmp47_ = gxml_parser_current_node_name (self);
						_tmp48_ = _tmp47_;
						_tmp49_ = g_utf8_strdown (_tmp48_, (gssize) -1);
						_tmp50_ = _tmp49_;
						_g_free0 (_tmp48_);
						n = _tmp50_;
						_tmp51_ = obj_types;
						_tmp52_ = n;
						if (g_hash_table_contains (_tmp51_, _tmp52_)) {
							GHashTable* _tmp53_;
							const gchar* _tmp54_;
							gconstpointer _tmp55_;
							_tmp53_ = obj_types;
							_tmp54_ = n;
							_tmp55_ = g_hash_table_lookup (_tmp53_, _tmp54_);
							obj_type = (GType) ((gintptr) _tmp55_);
						}
						_g_free0 (n);
					}
					_g_hash_table_unref0 (obj_types);
				} else {
					gboolean _tmp56_ = FALSE;
					GXmlCollection* _tmp57_;
					const gchar* _tmp58_;
					const gchar* _tmp59_;
					gboolean _tmp67_ = FALSE;
					GXmlCollection* _tmp68_;
					GXmlDomElement* _tmp69_;
					GXmlDomElement* _tmp70_;
					GXmlCollection* _tmp78_;
					GXmlDomElement* _tmp79_;
					GXmlDomElement* _tmp80_;
					GXmlCollection* _tmp87_;
					const gchar* _tmp88_;
					const gchar* _tmp89_;
					gchar* _tmp90_;
					gchar* _tmp91_;
					gchar* _tmp92_;
					gchar* _tmp93_;
					gchar* _tmp94_;
					gchar* _tmp95_;
					gboolean _tmp96_;
					_tmp57_ = col;
					_tmp58_ = gxml_collection_get_items_name (_tmp57_);
					_tmp59_ = _tmp58_;
					if (g_strcmp0 (_tmp59_, "") == 0) {
						_tmp56_ = TRUE;
					} else {
						GXmlCollection* _tmp60_;
						const gchar* _tmp61_;
						const gchar* _tmp62_;
						_tmp60_ = col;
						_tmp61_ = gxml_collection_get_items_name (_tmp60_);
						_tmp62_ = _tmp61_;
						_tmp56_ = _tmp62_ == NULL;
					}
					if (_tmp56_) {
						GXmlCollection* _tmp63_;
						const gchar* _tmp64_;
						GError* _tmp65_;
						gboolean _tmp66_ = FALSE;
						_tmp63_ = col;
						_tmp64_ = g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) _tmp63_));
						_tmp65_ = g_error_new (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Collection '%s' hasn't been constructed properly: items' name property" \
" was not set at construction time"), _tmp64_);
						_inner_error0_ = _tmp65_;
						g_propagate_error (error, _inner_error0_);
						G_IS_VALUE (&vc) ? (g_value_unset (&vc), NULL) : NULL;
						_g_object_unref0 (col);
						_g_param_spec_unref0 (pspec);
						(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
						_g_object_unref0 (_vala_element);
						return _tmp66_;
					}
					_tmp68_ = col;
					_tmp69_ = gxml_collection_get_element (_tmp68_);
					_tmp70_ = _tmp69_;
					if (_tmp70_ == NULL) {
						_tmp67_ = TRUE;
					} else {
						GXmlCollection* _tmp71_;
						GXmlDomElement* _tmp72_;
						GXmlDomElement* _tmp73_;
						_tmp71_ = col;
						_tmp72_ = gxml_collection_get_element (_tmp71_);
						_tmp73_ = _tmp72_;
						_tmp67_ = !GXML_IS_OBJECT (_tmp73_);
					}
					if (_tmp67_) {
						GXmlCollection* _tmp74_;
						const gchar* _tmp75_;
						GError* _tmp76_;
						gboolean _tmp77_ = FALSE;
						_tmp74_ = col;
						_tmp75_ = g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) _tmp74_));
						_tmp76_ = g_error_new (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Collection '%s' hasn't been constructed properly: element property was" \
" not set at construction time"), _tmp75_);
						_inner_error0_ = _tmp76_;
						g_propagate_error (error, _inner_error0_);
						G_IS_VALUE (&vc) ? (g_value_unset (&vc), NULL) : NULL;
						_g_object_unref0 (col);
						_g_param_spec_unref0 (pspec);
						(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
						_g_object_unref0 (_vala_element);
						return _tmp77_;
					}
					_tmp78_ = col;
					_tmp79_ = gxml_collection_get_element (_tmp78_);
					_tmp80_ = _tmp79_;
					if (!GXML_IS_OBJECT (_tmp80_)) {
						GXmlCollection* _tmp81_;
						GXmlDomElement* _tmp82_;
						GXmlDomElement* _tmp83_;
						const gchar* _tmp84_;
						GError* _tmp85_;
						gboolean _tmp86_ = FALSE;
						_tmp81_ = col;
						_tmp82_ = gxml_collection_get_element (_tmp81_);
						_tmp83_ = _tmp82_;
						_tmp84_ = g_type_name (G_TYPE_FROM_INSTANCE ((GObject*) _tmp83_));
						_tmp85_ = g_error_new (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Invalid object of type '%s' doesn't implement GXml.Object interface: c" \
"an't be handled by the collection"), _tmp84_);
						_inner_error0_ = _tmp85_;
						g_propagate_error (error, _inner_error0_);
						G_IS_VALUE (&vc) ? (g_value_unset (&vc), NULL) : NULL;
						_g_object_unref0 (col);
						_g_param_spec_unref0 (pspec);
						(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
						_g_object_unref0 (_vala_element);
						return _tmp86_;
					}
					_tmp87_ = col;
					_tmp88_ = gxml_collection_get_items_name (_tmp87_);
					_tmp89_ = _tmp88_;
					_tmp90_ = g_utf8_strdown (_tmp89_, (gssize) -1);
					_tmp91_ = _tmp90_;
					_tmp92_ = gxml_parser_current_node_name (self);
					_tmp93_ = _tmp92_;
					_tmp94_ = g_utf8_strdown (_tmp93_, (gssize) -1);
					_tmp95_ = _tmp94_;
					_tmp96_ = g_strcmp0 (_tmp91_, _tmp95_) == 0;
					_g_free0 (_tmp95_);
					_g_free0 (_tmp93_);
					_g_free0 (_tmp91_);
					if (_tmp96_) {
						GXmlDomDocument* _tmp97_;
						GXmlDomDocument* _tmp98_;
						GXmlCollection* _tmp101_;
						GType _tmp102_;
						GType _tmp103_;
						_tmp97_ = gxml_dom_node_get_owner_document (parent);
						_tmp98_ = _tmp97_;
						if (_tmp98_ == NULL) {
							GError* _tmp99_;
							gboolean _tmp100_ = FALSE;
							_tmp99_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("No document is set to node"));
							_inner_error0_ = _tmp99_;
							g_propagate_error (error, _inner_error0_);
							G_IS_VALUE (&vc) ? (g_value_unset (&vc), NULL) : NULL;
							_g_object_unref0 (col);
							_g_param_spec_unref0 (pspec);
							(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
							_g_object_unref0 (_vala_element);
							return _tmp100_;
						}
						_tmp101_ = col;
						_tmp102_ = gxml_collection_get_items_type (_tmp101_);
						_tmp103_ = _tmp102_;
						obj_type = _tmp103_;
					}
				}
				if (obj_type != G_TYPE_INVALID) {
					GXmlDomElement* obj = NULL;
					GXmlDomNode* _tmp104_;
					GXmlDomNode* _tmp105_;
					GXmlDomDocument* _tmp106_;
					GXmlDomDocument* _tmp107_;
					GObject* _tmp108_;
					GObject* _tmp109_;
					GXmlDomElement* _tmp110_;
					GXmlDomElement* _tmp111_;
					GXmlDomNode* _tmp112_;
					GXmlDomNode* _tmp113_;
					GXmlDomElement* _tmp115_;
					GXmlCollection* _tmp117_;
					GXmlDomElement* _tmp118_;
					GXmlDomElement* _tmp120_;
					GXmlDomNode* _tmp121_;
					_tmp104_ = gxml_parser_get_node (self);
					_tmp105_ = _tmp104_;
					_tmp106_ = gxml_dom_node_get_owner_document (_tmp105_);
					_tmp107_ = _tmp106_;
					_tmp108_ = g_object_new (obj_type, "owner-document", _tmp107_, NULL);
					_tmp109_ = G_IS_INITIALLY_UNOWNED (_tmp108_) ? g_object_ref_sink (_tmp108_) : _tmp108_;
					_tmp110_ = GXML_IS_DOM_ELEMENT (_tmp109_) ? ((GXmlDomElement*) _tmp109_) : NULL;
					if (_tmp110_ == NULL) {
						_g_object_unref0 (_tmp109_);
					}
					obj = _tmp110_;
					_tmp111_ = obj;
					_tmp112_ = gxml_dom_node_append_child (parent, (GXmlDomNode*) _tmp111_, &_inner_error0_);
					_tmp113_ = _tmp112_;
					_g_object_unref0 (_tmp113_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						gboolean _tmp114_ = FALSE;
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (obj);
						G_IS_VALUE (&vc) ? (g_value_unset (&vc), NULL) : NULL;
						_g_object_unref0 (col);
						_g_param_spec_unref0 (pspec);
						(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
						_g_object_unref0 (_vala_element);
						return _tmp114_;
					}
					_tmp115_ = obj;
					gxml_parser_read_element (self, GXML_IS_DOM_ELEMENT (_tmp115_) ? ((GXmlDomElement*) _tmp115_) : NULL, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						gboolean _tmp116_ = FALSE;
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (obj);
						G_IS_VALUE (&vc) ? (g_value_unset (&vc), NULL) : NULL;
						_g_object_unref0 (col);
						_g_param_spec_unref0 (pspec);
						(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
						_g_object_unref0 (_vala_element);
						return _tmp116_;
					}
					_tmp117_ = col;
					_tmp118_ = obj;
					gxml_collection_append (_tmp117_, _tmp118_, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						gboolean _tmp119_ = FALSE;
						g_propagate_error (error, _inner_error0_);
						_g_object_unref0 (obj);
						G_IS_VALUE (&vc) ? (g_value_unset (&vc), NULL) : NULL;
						_g_object_unref0 (col);
						_g_param_spec_unref0 (pspec);
						(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
						_g_object_unref0 (_vala_element);
						return _tmp119_;
					}
					_tmp120_ = obj;
					_tmp121_ = _g_object_ref0 ((GXmlDomNode*) _tmp120_);
					_g_object_unref0 (_vala_element);
					_vala_element = _tmp121_;
					result = TRUE;
					_g_object_unref0 (obj);
					G_IS_VALUE (&vc) ? (g_value_unset (&vc), NULL) : NULL;
					_g_object_unref0 (col);
					_g_param_spec_unref0 (pspec);
					(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
					if (element) {
						*element = _vala_element;
					} else {
						_g_object_unref0 (_vala_element);
					}
					return result;
				}
				G_IS_VALUE (&vc) ? (g_value_unset (&vc), NULL) : NULL;
				_g_object_unref0 (col);
				_g_param_spec_unref0 (pspec);
			}
		}
		(pspec_collection == NULL) ? NULL : (pspec_collection = (_g_list_free__g_param_spec_unref0_ (pspec_collection), NULL));
	}
	result = FALSE;
	if (element) {
		*element = _vala_element;
	} else {
		_g_object_unref0 (_vala_element);
	}
	return result;
}

gboolean
gxml_parser_add_element_collection (GXmlParser* self,
                                    GXmlDomNode* parent,
                                    GXmlDomNode** element,
                                    GError** error)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->add_element_collection) {
		return _iface_->add_element_collection (self, parent, element, error);
	}
	return FALSE;
}

/**
   * Read all children node feed by stream.
   */
void
gxml_parser_read_child_nodes_stream (GXmlParser* self,
                                     GInputStream* istream,
                                     GError** error)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_child_nodes_stream) {
		_iface_->read_child_nodes_stream (self, istream, error);
	}
}

/**
   * Read children nodes from string
   */
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_dup3 (guint8* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static void
gxml_parser_real_read_child_nodes_string (GXmlParser* self,
                                          const gchar* str,
                                          GError** error)
{
	GMemoryInputStream* stream = NULL;
	guint8* _tmp1_;
	gint _tmp1__length1;
	gint _tmp2_ = 0;
	guint8* _tmp3_;
	gint _tmp3__length1;
	guint8* _tmp4_;
	gint _tmp4__length1;
	GDestroyNotify _tmp5_;
	GMemoryInputStream* _tmp6_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (str != NULL);
	if (g_strcmp0 (str, "") == 0) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GXML_PARSER_ERROR, GXML_PARSER_ERROR_INVALID_DATA_ERROR, _ ("Invalid document string, it is empty or is not allowed"));
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return;
	}
	_tmp1_ = string_get_data (str, &_tmp2_);
	_tmp1__length1 = _tmp2_;
	_tmp3_ = _tmp1_;
	_tmp3__length1 = _tmp1__length1;
	_tmp4_ = (_tmp3_ != NULL) ? _vala_array_dup3 (_tmp3_, _tmp3__length1) : _tmp3_;
	_tmp4__length1 = _tmp3__length1;
	_tmp5_ = g_free;
	_tmp6_ = (GMemoryInputStream*) g_memory_input_stream_new_from_data (_tmp4_, _tmp4__length1, _tmp5_);
	stream = _tmp6_;
	gxml_parser_read_child_nodes_stream (self, (GInputStream*) stream, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (stream);
		return;
	}
	_g_object_unref0 (stream);
}

void
gxml_parser_read_child_nodes_string (GXmlParser* self,
                                     const gchar* str,
                                     GError** error)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_child_nodes_string) {
		_iface_->read_child_nodes_string (self, str, error);
	}
}

/**
   * Reads all child nodes as string
   */
gchar*
gxml_parser_read_unparsed (GXmlParser* self,
                           GError** error)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_unparsed) {
		return _iface_->read_unparsed (self, error);
	}
	return NULL;
}

/**
   * Use parser to go to next parsed node.
   */
gboolean
gxml_parser_move_next_node (GXmlParser* self,
                            GError** error)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->move_next_node) {
		return _iface_->move_next_node (self, error);
	}
	return FALSE;
}

/**
   * Check if current node has children.
   */
gboolean
gxml_parser_current_is_empty_element (GXmlParser* self)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->current_is_empty_element) {
		return _iface_->current_is_empty_element (self);
	}
	return FALSE;
}

/**
   * Check if current node found by parser, is a {@link DomElement}
   */
gboolean
gxml_parser_current_is_element (GXmlParser* self)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->current_is_element) {
		return _iface_->current_is_element (self);
	}
	return FALSE;
}

/**
   * Check if current node found by parser, is a {@link DomDocument}
   */
gboolean
gxml_parser_current_is_document (GXmlParser* self)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->current_is_document) {
		return _iface_->current_is_document (self);
	}
	return FALSE;
}

/**
   * Returns current node's local name, found by parser.
   */
gchar*
gxml_parser_current_node_name (GXmlParser* self)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->current_node_name) {
		return _iface_->current_node_name (self);
	}
	return NULL;
}

/**
   * Creates a new {@link DomElement} and append it as a child of parent.
   */
GXmlDomElement*
gxml_parser_create_element (GXmlParser* self,
                            GXmlDomNode* parent,
                            GError** error)
{
	GXmlParserIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->create_element) {
		return _iface_->create_element (self, parent, error);
	}
	return NULL;
}

/**
   * Reads an element's attributes, setting its values and taking care about their
   * namespaces.
   */
void
gxml_parser_read_element (GXmlParser* self,
                          GXmlDomElement* element,
                          GError** error)
{
	GXmlParserIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_PARSER_GET_INTERFACE (self);
	if (_iface_->read_element) {
		_iface_->read_element (self, element, error);
	}
}

static void
gxml_parser_default_init (GXmlParserIface * iface,
                          gpointer iface_data)
{
	/**
	   * Controls if, when writing to a file, a backup should
	   * be created.
	   */
	g_object_interface_install_property (iface, g_param_spec_boolean ("backup", "backup", "backup", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * Controls if, when writing, indentation should be used.
	   */
	g_object_interface_install_property (iface, g_param_spec_boolean ("indent", "indent", "indent", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * Controls if, when writing, indentation should be used.
	   */
	g_object_interface_install_property (iface, g_param_spec_object ("cancellable", "cancellable", "cancellable", g_cancellable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * A {@link GXml.DomDocument} to read to or write from
	   */
	g_object_interface_install_property (iface, g_param_spec_object ("node", "node", "node", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	   * A collection of child types of found {@link GXml.CollectionParent}
	   * objects, used to instantiate the correct class based on the
	   * node's name.
	   *
	   * The map use the {@link GLib.Type} of the object implementing
	   * {@link GXml.CollectionParent} as the key, to get a {@link GLib.HashTable}
	   * holding a set of instantiable child classes, with the key as the
	   * lowercase of the node's local name to get the {@link GLib.Type}
	   * of the instantiable class to create and add to the collection.
	   */
	g_object_interface_install_property (iface, g_param_spec_boxed ("types", "types", "types", G_TYPE_HASH_TABLE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	iface->write_file = gxml_parser_real_write_file;
	iface->write_file_async = gxml_parser_real_write_file_async;
	iface->write_file_finish = gxml_parser_real_write_file_finish;
	iface->read_file = gxml_parser_real_read_file;
	iface->read_file_async = gxml_parser_real_read_file_async;
	iface->read_file_finish = gxml_parser_real_read_file_finish;
	iface->read_child_nodes = gxml_parser_real_read_child_nodes;
	iface->read_child_nodes_async = gxml_parser_real_read_child_nodes_async;
	iface->read_child_nodes_finish = gxml_parser_real_read_child_nodes_finish;
	iface->read_child_element = gxml_parser_real_read_child_element;
	iface->read_element_property = gxml_parser_real_read_element_property;
	iface->add_element_collection = gxml_parser_real_add_element_collection;
	iface->read_child_nodes_string = gxml_parser_real_read_child_nodes_string;
}

/**
 * XML parser engine for {@link DomDocument} implementations.
 */
static GType
gxml_parser_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlParserIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_parser_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gxml_parser_type_id;
	gxml_parser_type_id = g_type_register_static (G_TYPE_INTERFACE, "GXmlParser", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gxml_parser_type_id, G_TYPE_OBJECT);
	return gxml_parser_type_id;
}

GType
gxml_parser_get_type (void)
{
	static volatile gsize gxml_parser_type_id__once = 0;
	if (g_once_init_enter (&gxml_parser_type_id__once)) {
		GType gxml_parser_type_id;
		gxml_parser_type_id = gxml_parser_get_type_once ();
		g_once_init_leave (&gxml_parser_type_id__once, gxml_parser_type_id);
	}
	return gxml_parser_type_id__once;
}

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;
}

