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

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/*
 *
 * Copyright (C) 2016  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 <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <gee.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)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _GxmlDomElementReadFromUriAsyncData GxmlDomElementReadFromUriAsyncData;
typedef struct _GxmlDomElementReadFromFileAsyncData GxmlDomElementReadFromFileAsyncData;
typedef struct _GxmlDomElementReadFromStreamAsyncData GxmlDomElementReadFromStreamAsyncData;
typedef struct _GxmlDomElementReadFromStringAsyncData GxmlDomElementReadFromStringAsyncData;
typedef struct _GxmlDomElementWriteStringAsyncData GxmlDomElementWriteStringAsyncData;
typedef struct _GxmlDomElementWriteFileAsyncData GxmlDomElementWriteFileAsyncData;
typedef struct _GxmlDomElementWriteStreamAsyncData GxmlDomElementWriteStreamAsyncData;
typedef struct _GxmlDomElementCreateStreamAsyncData GxmlDomElementCreateStreamAsyncData;
enum  {
	GXML_DOM_ELEMENT_LIST_0_PROPERTY,
	GXML_DOM_ELEMENT_LIST_NUM_PROPERTIES
};
static GParamSpec* gxml_dom_element_list_properties[GXML_DOM_ELEMENT_LIST_NUM_PROPERTIES];

struct _GxmlDomElementReadFromUriAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomElement* self;
	gchar* uri;
	GCancellable* cancellable;
	GFile* _tmp0_;
	GFile* _tmp1_;
	GError* _inner_error0_;
};

struct _GxmlDomElementReadFromFileAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomElement* self;
	GFile* f;
	GCancellable* cancellable;
};

struct _GxmlDomElementReadFromStreamAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomElement* self;
	GInputStream* istream;
	GCancellable* cancellable;
};

struct _GxmlDomElementReadFromStringAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomElement* self;
	gchar* str;
	GCancellable* cancellable;
};

struct _GxmlDomElementWriteStringAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomElement* self;
	GCancellable* cancellable;
	gchar* result;
	gchar* _tmp0_;
};

struct _GxmlDomElementWriteFileAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomElement* self;
	GFile* f;
	GCancellable* cancellable;
	GXmlDomDocument* _tmp0_;
	GXmlDomDocument* _tmp1_;
	GError* _inner_error0_;
};

struct _GxmlDomElementWriteStreamAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomElement* self;
	GOutputStream* stream;
	GCancellable* cancellable;
	GXmlDomDocument* _tmp0_;
	GXmlDomDocument* _tmp1_;
	GError* _inner_error0_;
};

struct _GxmlDomElementCreateStreamAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomElement* self;
	GCancellable* cancellable;
	GInputStream* result;
	GInputStream* _tmp0_;
	GXmlDomDocument* _tmp1_;
	GXmlDomDocument* _tmp2_;
	GInputStream* _tmp3_;
	GInputStream* _tmp4_;
	GError* _inner_error0_;
};

static gpointer gxml_dom_element_list_parent_class = NULL;
static GXmlDomHTMLCollectionIface * gxml_dom_element_list_gxml_dom_html_collection_parent_iface = NULL;

static gboolean gxml_dom_element_real_matches (GXmlDomElement* self,
                                        const gchar* selectors,
                                        GError** error);
static void gxml_dom_element_real_read_from_uri (GXmlDomElement* self,
                                          const gchar* uri,
                                          GError** error);
static void gxml_dom_element_real_read_from_uri_async_data_free (gpointer _data);
static void gxml_dom_element_real_read_from_uri_async (GXmlDomElement* self,
                                                const gchar* uri,
                                                GCancellable* cancellable,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static gboolean gxml_dom_element_real_read_from_uri_async_co (GxmlDomElementReadFromUriAsyncData* _data_);
static void gxml_dom_element_read_from_uri_async_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static void gxml_dom_element_real_read_from_file (GXmlDomElement* self,
                                           GFile* f,
                                           GCancellable* cancellable,
                                           GError** error);
static void gxml_dom_element_real_read_from_file_async_data_free (gpointer _data);
static void gxml_dom_element_real_read_from_file_async (GXmlDomElement* self,
                                                 GFile* f,
                                                 GCancellable* cancellable,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static gboolean gxml_dom_element_real_read_from_file_async_co (GxmlDomElementReadFromFileAsyncData* _data_);
static void gxml_dom_element_real_read_from_stream (GXmlDomElement* self,
                                             GInputStream* istream,
                                             GCancellable* cancellable,
                                             GError** error);
static void gxml_dom_element_real_read_from_stream_async_data_free (gpointer _data);
static void gxml_dom_element_real_read_from_stream_async (GXmlDomElement* self,
                                                   GInputStream* istream,
                                                   GCancellable* cancellable,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_);
static gboolean gxml_dom_element_real_read_from_stream_async_co (GxmlDomElementReadFromStreamAsyncData* _data_);
static void gxml_dom_element_real_read_from_string (GXmlDomElement* self,
                                             const gchar* str,
                                             GCancellable* cancellable,
                                             GError** error);
static void gxml_dom_element_real_read_from_string_async_data_free (gpointer _data);
static void gxml_dom_element_real_read_from_string_async (GXmlDomElement* self,
                                                   const gchar* str,
                                                   GCancellable* cancellable,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_);
static gboolean gxml_dom_element_real_read_from_string_async_co (GxmlDomElementReadFromStringAsyncData* _data_);
static gchar* gxml_dom_element_real_write_string (GXmlDomElement* self,
                                           GCancellable* cancellable,
                                           GError** error);
static void gxml_dom_element_real_write_string_async_data_free (gpointer _data);
static void gxml_dom_element_real_write_string_async (GXmlDomElement* self,
                                               GCancellable* cancellable,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static gboolean gxml_dom_element_real_write_string_async_co (GxmlDomElementWriteStringAsyncData* _data_);
static void gxml_dom_element_real_write_file (GXmlDomElement* self,
                                       GFile* f,
                                       GCancellable* cancellable,
                                       GError** error);
static void gxml_dom_element_real_write_file_async_data_free (gpointer _data);
static void gxml_dom_element_real_write_file_async (GXmlDomElement* self,
                                             GFile* f,
                                             GCancellable* cancellable,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static gboolean gxml_dom_element_real_write_file_async_co (GxmlDomElementWriteFileAsyncData* _data_);
static void gxml_dom_element_write_file_async_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static void gxml_dom_element_real_write_stream (GXmlDomElement* self,
                                         GOutputStream* stream,
                                         GError** error);
static void gxml_dom_element_real_write_stream_async_data_free (gpointer _data);
static void gxml_dom_element_real_write_stream_async (GXmlDomElement* self,
                                               GOutputStream* stream,
                                               GCancellable* cancellable,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static gboolean gxml_dom_element_real_write_stream_async_co (GxmlDomElementWriteStreamAsyncData* _data_);
static void gxml_dom_element_write_stream_async_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static GInputStream* gxml_dom_element_real_create_stream (GXmlDomElement* self,
                                                   GError** error);
static void gxml_dom_element_real_create_stream_async_data_free (gpointer _data);
static void gxml_dom_element_real_create_stream_async (GXmlDomElement* self,
                                                GCancellable* cancellable,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static gboolean gxml_dom_element_real_create_stream_async_co (GxmlDomElementCreateStreamAsyncData* _data_);
static void gxml_dom_element_create_stream_async_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static GType gxml_dom_element_get_type_once (void);
static GXmlDomElement* gxml_dom_element_list_real_get_element (GXmlDomHTMLCollection* base,
                                                        gint index);
static GType gxml_dom_element_list_get_type_once (void);

gchar*
gxml_dom_element_get_namespace_uri (GXmlDomElement* self)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_namespace_uri) {
		return _iface_->get_namespace_uri (self);
	}
	return NULL;
}

gchar*
gxml_dom_element_get_prefix (GXmlDomElement* self)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_prefix) {
		return _iface_->get_prefix (self);
	}
	return NULL;
}

gchar*
gxml_dom_element_get_local_name (GXmlDomElement* self)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_local_name) {
		return _iface_->get_local_name (self);
	}
	return NULL;
}

gchar*
gxml_dom_element_get_tag_name (GXmlDomElement* self)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_tag_name) {
		return _iface_->get_tag_name (self);
	}
	return NULL;
}

gchar*
gxml_dom_element_get_id (GXmlDomElement* self)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_id) {
		return _iface_->get_id (self);
	}
	return NULL;
}

void
gxml_dom_element_set_id (GXmlDomElement* self,
                         const gchar* value)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->set_id) {
		_iface_->set_id (self, value);
	}
}

gchar*
gxml_dom_element_get_class_name (GXmlDomElement* self)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_class_name) {
		return _iface_->get_class_name (self);
	}
	return NULL;
}

void
gxml_dom_element_set_class_name (GXmlDomElement* self,
                                 const gchar* value)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->set_class_name) {
		_iface_->set_class_name (self, value);
	}
}

GXmlDomTokenList*
gxml_dom_element_get_class_list (GXmlDomElement* self)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_class_list) {
		return _iface_->get_class_list (self);
	}
	return NULL;
}

GXmlDomNamedNodeMap*
gxml_dom_element_get_attributes (GXmlDomElement* self)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_attributes) {
		return _iface_->get_attributes (self);
	}
	return NULL;
}

gchar*
gxml_dom_element_get_attribute (GXmlDomElement* self,
                                const gchar* name)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_attribute) {
		return _iface_->get_attribute (self, name);
	}
	return NULL;
}

gchar*
gxml_dom_element_get_attribute_ns (GXmlDomElement* self,
                                   const gchar* namespace,
                                   const gchar* local_name)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_attribute_ns) {
		return _iface_->get_attribute_ns (self, namespace, local_name);
	}
	return NULL;
}

void
gxml_dom_element_set_attribute (GXmlDomElement* self,
                                const gchar* name,
                                const gchar* value,
                                GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->set_attribute) {
		_iface_->set_attribute (self, name, value, error);
	}
}

/**
   * Set an attribute value to this element. If it doesn't exists yet, it is added
   * to the list of attributes, unless it is an namespace redefinition.
   *
   * To set a namespace declaration [[http://www.w3.org/2000/xmlns]] namespace and xmlns
   * as prefix. For default namespaces, use xmlns as name without prefix. Namespace
   * URI will be the one provided as value.
   *
   * @param name a prefixed attribute name or xmlns for default namespace declaration
   * @param value a value for the attribute or URI for namespace declaration
   */
void
gxml_dom_element_set_attribute_ns (GXmlDomElement* self,
                                   const gchar* namespace,
                                   const gchar* name,
                                   const gchar* value,
                                   GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->set_attribute_ns) {
		_iface_->set_attribute_ns (self, namespace, name, value, error);
	}
}

void
gxml_dom_element_remove_attribute (GXmlDomElement* self,
                                   const gchar* name)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->remove_attribute) {
		_iface_->remove_attribute (self, name);
	}
}

void
gxml_dom_element_remove_attribute_ns (GXmlDomElement* self,
                                      const gchar* namespace,
                                      const gchar* local_name)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->remove_attribute_ns) {
		_iface_->remove_attribute_ns (self, namespace, local_name);
	}
}

gboolean
gxml_dom_element_has_attribute (GXmlDomElement* self,
                                const gchar* name)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->has_attribute) {
		return _iface_->has_attribute (self, name);
	}
	return FALSE;
}

gboolean
gxml_dom_element_has_attribute_ns (GXmlDomElement* self,
                                   const gchar* namespace,
                                   const gchar* local_name)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->has_attribute_ns) {
		return _iface_->has_attribute_ns (self, namespace, local_name);
	}
	return FALSE;
}

GXmlDomHTMLCollection*
gxml_dom_element_get_elements_by_tag_name (GXmlDomElement* self,
                                           const gchar* local_name)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_elements_by_tag_name) {
		return _iface_->get_elements_by_tag_name (self, local_name);
	}
	return NULL;
}

GXmlDomHTMLCollection*
gxml_dom_element_get_elements_by_tag_name_ns (GXmlDomElement* self,
                                              const gchar* namespace,
                                              const gchar* local_name)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_elements_by_tag_name_ns) {
		return _iface_->get_elements_by_tag_name_ns (self, namespace, local_name);
	}
	return NULL;
}

GXmlDomHTMLCollection*
gxml_dom_element_get_elements_by_class_name (GXmlDomElement* self,
                                             const gchar* class_names)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->get_elements_by_class_name) {
		return _iface_->get_elements_by_class_name (self, class_names);
	}
	return NULL;
}

static gboolean
gxml_dom_element_real_matches (GXmlDomElement* self,
                               const gchar* selectors,
                               GError** error)
{
	GXmlCssSelectorParser* parser = NULL;
	GXmlCssSelectorParser* _tmp0_;
	GXmlCssSelectorParser* _tmp1_;
	gboolean _tmp3_ = FALSE;
	GXmlCssSelectorParser* _tmp4_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (selectors != NULL, FALSE);
	_tmp0_ = gxml_css_selector_parser_new ();
	parser = _tmp0_;
	_tmp1_ = parser;
	gxml_css_selector_parser_parse (_tmp1_, selectors, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp2_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return _tmp2_;
	}
	_tmp4_ = parser;
	_tmp3_ = gxml_css_selector_parser_match (_tmp4_, self, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp5_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return _tmp5_;
	}
	result = _tmp3_;
	_g_object_unref0 (parser);
	return result;
}

gboolean
gxml_dom_element_matches (GXmlDomElement* self,
                          const gchar* selectors,
                          GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->matches) {
		return _iface_->matches (self, selectors, error);
	}
	return FALSE;
}

/**
   * Parsing a URI file.
   */
static void
gxml_dom_element_real_read_from_uri (GXmlDomElement* self,
                                     const gchar* uri,
                                     GError** error)
{
	GFile* _tmp0_;
	GFile* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (uri != NULL);
	_tmp0_ = g_file_new_for_uri (uri);
	_tmp1_ = _tmp0_;
	gxml_dom_element_read_from_file (self, _tmp1_, NULL, &_inner_error0_);
	_g_object_unref0 (_tmp1_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
}

void
gxml_dom_element_read_from_uri (GXmlDomElement* self,
                                const gchar* uri,
                                GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_uri) {
		_iface_->read_from_uri (self, uri, error);
	}
}

static void
gxml_dom_element_real_read_from_uri_async_data_free (gpointer _data)
{
	GxmlDomElementReadFromUriAsyncData* _data_;
	_data_ = _data;
	_g_free0 (_data_->uri);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlDomElementReadFromUriAsyncData, _data_);
}

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

static void
gxml_dom_element_real_read_from_uri_async (GXmlDomElement* self,
                                           const gchar* uri,
                                           GCancellable* cancellable,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	GxmlDomElementReadFromUriAsyncData* _data_;
	GXmlDomElement* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (uri != NULL);
	_data_ = g_slice_new0 (GxmlDomElementReadFromUriAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_element_real_read_from_uri_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (uri);
	_g_free0 (_data_->uri);
	_data_->uri = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_element_real_read_from_uri_async_co (_data_);
}

static void
gxml_dom_element_real_read_from_uri_finish (GXmlDomElement* self,
                                            GAsyncResult* _res_,
                                            GError** error)
{
	GxmlDomElementReadFromUriAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Parsing asinchronically a URI file.
   */
static void
gxml_dom_element_read_from_uri_async_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	GxmlDomElementReadFromUriAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_dom_element_real_read_from_uri_async_co (_data_);
}

static gboolean
gxml_dom_element_real_read_from_uri_async_co (GxmlDomElementReadFromUriAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_file_new_for_uri (_data_->uri);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_state_ = 1;
	gxml_dom_element_read_from_file_async (_data_->self, _data_->_tmp1_, NULL, gxml_dom_element_read_from_uri_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_dom_element_read_from_file_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
	_g_object_unref0 (_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;
	}
	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_dom_element_read_from_uri_async (GXmlDomElement* self,
                                      const gchar* uri,
                                      GCancellable* cancellable,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_uri_async) {
		_iface_->read_from_uri_async (self, uri, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_element_read_from_uri_finish (GXmlDomElement* self,
                                       GAsyncResult* _res_,
                                       GError** error)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_uri_finish) {
		_iface_->read_from_uri_finish (self, _res_, error);
	}
}

/**
   * Parses an XML file, deserializing it over {@link GXml.Element}.
   */
static void
gxml_dom_element_real_read_from_file (GXmlDomElement* self,
                                      GFile* f,
                                      GCancellable* cancellable,
                                      GError** error)
{
	g_return_if_fail (f != NULL);
}

void
gxml_dom_element_read_from_file (GXmlDomElement* self,
                                 GFile* f,
                                 GCancellable* cancellable,
                                 GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_file) {
		_iface_->read_from_file (self, f, cancellable, error);
	}
}

static void
gxml_dom_element_real_read_from_file_async_data_free (gpointer _data)
{
	GxmlDomElementReadFromFileAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->f);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlDomElementReadFromFileAsyncData, _data_);
}

static void
gxml_dom_element_real_read_from_file_async (GXmlDomElement* self,
                                            GFile* f,
                                            GCancellable* cancellable,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	GxmlDomElementReadFromFileAsyncData* _data_;
	GXmlDomElement* _tmp0_;
	GFile* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (f != NULL);
	_data_ = g_slice_new0 (GxmlDomElementReadFromFileAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_element_real_read_from_file_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (f);
	_g_object_unref0 (_data_->f);
	_data_->f = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_element_real_read_from_file_async_co (_data_);
}

static void
gxml_dom_element_real_read_from_file_finish (GXmlDomElement* self,
                                             GAsyncResult* _res_,
                                             GError** error)
{
	GxmlDomElementReadFromFileAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Parses asinchronically an XML file, deserializing it over {@link GXml.Element}.
   */
static gboolean
gxml_dom_element_real_read_from_file_async_co (GxmlDomElementReadFromFileAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	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_dom_element_read_from_file_async (GXmlDomElement* self,
                                       GFile* f,
                                       GCancellable* cancellable,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_file_async) {
		_iface_->read_from_file_async (self, f, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_element_read_from_file_finish (GXmlDomElement* self,
                                        GAsyncResult* _res_,
                                        GError** error)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_file_finish) {
		_iface_->read_from_file_finish (self, _res_, error);
	}
}

/**
   * Parses an XML over a {@link GLib.InputStream}, deserializing it over {@link GXml.Element}.
   */
static void
gxml_dom_element_real_read_from_stream (GXmlDomElement* self,
                                        GInputStream* istream,
                                        GCancellable* cancellable,
                                        GError** error)
{
	g_return_if_fail (istream != NULL);
}

void
gxml_dom_element_read_from_stream (GXmlDomElement* self,
                                   GInputStream* istream,
                                   GCancellable* cancellable,
                                   GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_stream) {
		_iface_->read_from_stream (self, istream, cancellable, error);
	}
}

static void
gxml_dom_element_real_read_from_stream_async_data_free (gpointer _data)
{
	GxmlDomElementReadFromStreamAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->istream);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlDomElementReadFromStreamAsyncData, _data_);
}

static void
gxml_dom_element_real_read_from_stream_async (GXmlDomElement* self,
                                              GInputStream* istream,
                                              GCancellable* cancellable,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	GxmlDomElementReadFromStreamAsyncData* _data_;
	GXmlDomElement* _tmp0_;
	GInputStream* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (istream != NULL);
	_data_ = g_slice_new0 (GxmlDomElementReadFromStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_element_real_read_from_stream_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (istream);
	_g_object_unref0 (_data_->istream);
	_data_->istream = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_element_real_read_from_stream_async_co (_data_);
}

static void
gxml_dom_element_real_read_from_stream_finish (GXmlDomElement* self,
                                               GAsyncResult* _res_,
                                               GError** error)
{
	GxmlDomElementReadFromStreamAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Parses asynchronically an XML over a {@link GLib.InputStream}, deserializing it over {@link GXml.Element}.
   */
static gboolean
gxml_dom_element_real_read_from_stream_async_co (GxmlDomElementReadFromStreamAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	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_dom_element_read_from_stream_async (GXmlDomElement* self,
                                         GInputStream* istream,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_stream_async) {
		_iface_->read_from_stream_async (self, istream, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_element_read_from_stream_finish (GXmlDomElement* self,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_stream_finish) {
		_iface_->read_from_stream_finish (self, _res_, error);
	}
}

/**
   * Parses an XML string, deserializing it over {@link GXml.Element}.
   */
static void
gxml_dom_element_real_read_from_string (GXmlDomElement* self,
                                        const gchar* str,
                                        GCancellable* cancellable,
                                        GError** error)
{
	g_return_if_fail (str != NULL);
}

void
gxml_dom_element_read_from_string (GXmlDomElement* self,
                                   const gchar* str,
                                   GCancellable* cancellable,
                                   GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_string) {
		_iface_->read_from_string (self, str, cancellable, error);
	}
}

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

static void
gxml_dom_element_real_read_from_string_async (GXmlDomElement* self,
                                              const gchar* str,
                                              GCancellable* cancellable,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	GxmlDomElementReadFromStringAsyncData* _data_;
	GXmlDomElement* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (str != NULL);
	_data_ = g_slice_new0 (GxmlDomElementReadFromStringAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_element_real_read_from_string_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (str);
	_g_free0 (_data_->str);
	_data_->str = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_element_real_read_from_string_async_co (_data_);
}

static void
gxml_dom_element_real_read_from_string_finish (GXmlDomElement* self,
                                               GAsyncResult* _res_,
                                               GError** error)
{
	GxmlDomElementReadFromStringAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Parses an XML string, deserializing it over {@link GXml.Element}.
   */
static gboolean
gxml_dom_element_real_read_from_string_async_co (GxmlDomElementReadFromStringAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	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_dom_element_read_from_string_async (GXmlDomElement* self,
                                         const gchar* str,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_string_async) {
		_iface_->read_from_string_async (self, str, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_element_read_from_string_finish (GXmlDomElement* self,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->read_from_string_finish) {
		_iface_->read_from_string_finish (self, _res_, error);
	}
}

/**
   * Serialize {@link GXml.Element} to a string.
   */
static gchar*
gxml_dom_element_real_write_string (GXmlDomElement* self,
                                    GCancellable* cancellable,
                                    GError** error)
{
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = g_strdup ("");
	result = _tmp0_;
	return result;
}

gchar*
gxml_dom_element_write_string (GXmlDomElement* self,
                               GCancellable* cancellable,
                               GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->write_string) {
		return _iface_->write_string (self, cancellable, error);
	}
	return NULL;
}

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

static void
gxml_dom_element_real_write_string_async (GXmlDomElement* self,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	GxmlDomElementWriteStringAsyncData* _data_;
	GXmlDomElement* _tmp0_;
	GCancellable* _tmp1_;
	_data_ = g_slice_new0 (GxmlDomElementWriteStringAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_element_real_write_string_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	gxml_dom_element_real_write_string_async_co (_data_);
}

static gchar*
gxml_dom_element_real_write_string_finish (GXmlDomElement* self,
                                           GAsyncResult* _res_,
                                           GError** error)
{
	gchar* result;
	GxmlDomElementWriteStringAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

/**
   * Serialize asinchronically {@link GXml.Element} to a string.
   */
static gboolean
gxml_dom_element_real_write_string_async_co (GxmlDomElementWriteStringAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_strdup ("");
	_data_->result = _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;
}

void
gxml_dom_element_write_string_async (GXmlDomElement* self,
                                     GCancellable* cancellable,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->write_string_async) {
		_iface_->write_string_async (self, cancellable, _callback_, _user_data_);
	}
}

gchar*
gxml_dom_element_write_string_finish (GXmlDomElement* self,
                                      GAsyncResult* _res_,
                                      GError** error)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->write_string_finish) {
		return _iface_->write_string_finish (self, _res_, error);
	}
	return NULL;
}

/**
   * Uses element's {@link GXml.Document} to write an XML to a file, serializing it.
   */
static void
gxml_dom_element_real_write_file (GXmlDomElement* self,
                                  GFile* f,
                                  GCancellable* cancellable,
                                  GError** error)
{
	GXmlDomDocument* _tmp0_;
	GXmlDomDocument* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (f != NULL);
	_tmp0_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	gxml_dom_document_write_file (_tmp1_, f, cancellable, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
}

void
gxml_dom_element_write_file (GXmlDomElement* self,
                             GFile* f,
                             GCancellable* cancellable,
                             GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->write_file) {
		_iface_->write_file (self, f, cancellable, error);
	}
}

static void
gxml_dom_element_real_write_file_async_data_free (gpointer _data)
{
	GxmlDomElementWriteFileAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->f);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlDomElementWriteFileAsyncData, _data_);
}

static void
gxml_dom_element_real_write_file_async (GXmlDomElement* self,
                                        GFile* f,
                                        GCancellable* cancellable,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	GxmlDomElementWriteFileAsyncData* _data_;
	GXmlDomElement* _tmp0_;
	GFile* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (f != NULL);
	_data_ = g_slice_new0 (GxmlDomElementWriteFileAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_element_real_write_file_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (f);
	_g_object_unref0 (_data_->f);
	_data_->f = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_element_real_write_file_async_co (_data_);
}

static void
gxml_dom_element_real_write_file_finish (GXmlDomElement* self,
                                         GAsyncResult* _res_,
                                         GError** error)
{
	GxmlDomElementWriteFileAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Uses element's {@link GXml.Document} to write asynchronically an XML to a file, serializing it.
   */
static void
gxml_dom_element_write_file_async_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	GxmlDomElementWriteFileAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_dom_element_real_write_file_async_co (_data_);
}

static gboolean
gxml_dom_element_real_write_file_async_co (GxmlDomElementWriteFileAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_state_ = 1;
	gxml_dom_document_write_file_async (_data_->_tmp1_, _data_->f, NULL, gxml_dom_element_write_file_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_dom_document_write_file_finish (_data_->_tmp1_, _data_->_res_, &_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;
}

void
gxml_dom_element_write_file_async (GXmlDomElement* self,
                                   GFile* f,
                                   GCancellable* cancellable,
                                   GAsyncReadyCallback _callback_,
                                   gpointer _user_data_)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->write_file_async) {
		_iface_->write_file_async (self, f, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_element_write_file_finish (GXmlDomElement* self,
                                    GAsyncResult* _res_,
                                    GError** error)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->write_file_finish) {
		_iface_->write_file_finish (self, _res_, error);
	}
}

/**
   * Uses element's {@link GXml.Document} to write an XML to a stream, serializing it.
   */
static void
gxml_dom_element_real_write_stream (GXmlDomElement* self,
                                    GOutputStream* stream,
                                    GError** error)
{
	GXmlDomDocument* _tmp0_;
	GXmlDomDocument* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (stream != NULL);
	_tmp0_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	gxml_dom_document_write_stream (_tmp1_, stream, NULL, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
}

void
gxml_dom_element_write_stream (GXmlDomElement* self,
                               GOutputStream* stream,
                               GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->write_stream) {
		_iface_->write_stream (self, stream, error);
	}
}

static void
gxml_dom_element_real_write_stream_async_data_free (gpointer _data)
{
	GxmlDomElementWriteStreamAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlDomElementWriteStreamAsyncData, _data_);
}

static void
gxml_dom_element_real_write_stream_async (GXmlDomElement* self,
                                          GOutputStream* stream,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	GxmlDomElementWriteStreamAsyncData* _data_;
	GXmlDomElement* _tmp0_;
	GOutputStream* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (stream != NULL);
	_data_ = g_slice_new0 (GxmlDomElementWriteStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_element_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_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_element_real_write_stream_async_co (_data_);
}

static void
gxml_dom_element_real_write_stream_finish (GXmlDomElement* self,
                                           GAsyncResult* _res_,
                                           GError** error)
{
	GxmlDomElementWriteStreamAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Uses element's {@link GXml.Document} to write an XML to a stream, serializing it.
   */
static void
gxml_dom_element_write_stream_async_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	GxmlDomElementWriteStreamAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_dom_element_real_write_stream_async_co (_data_);
}

static gboolean
gxml_dom_element_real_write_stream_async_co (GxmlDomElementWriteStreamAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_state_ = 1;
	gxml_dom_document_write_stream_async (_data_->_tmp1_, _data_->stream, NULL, gxml_dom_element_write_stream_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_dom_document_write_stream_finish (_data_->_tmp1_, _data_->_res_, &_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;
}

void
gxml_dom_element_write_stream_async (GXmlDomElement* self,
                                     GOutputStream* stream,
                                     GCancellable* cancellable,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->write_stream_async) {
		_iface_->write_stream_async (self, stream, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_element_write_stream_finish (GXmlDomElement* self,
                                      GAsyncResult* _res_,
                                      GError** error)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->write_stream_finish) {
		_iface_->write_stream_finish (self, _res_, error);
	}
}

/**
   * Creates an {@link GLib.InputStream} to write a string representation
   * in XML of {@link GXml.Element} using node's {@link GXml.Document}
   */
static GInputStream*
gxml_dom_element_real_create_stream (GXmlDomElement* self,
                                     GError** error)
{
	GInputStream* _tmp0_ = NULL;
	GXmlDomDocument* _tmp1_;
	GXmlDomDocument* _tmp2_;
	GInputStream* _tmp3_;
	GInputStream* _tmp4_;
	GError* _inner_error0_ = NULL;
	GInputStream* result;
	_tmp1_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = gxml_dom_document_create_stream (_tmp2_, &_inner_error0_);
	_tmp0_ = _tmp3_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp4_ = _tmp0_;
	_tmp0_ = NULL;
	result = _tmp4_;
	_g_object_unref0 (_tmp0_);
	return result;
}

GInputStream*
gxml_dom_element_create_stream (GXmlDomElement* self,
                                GError** error)
{
	GXmlDomElementIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->create_stream) {
		return _iface_->create_stream (self, error);
	}
	return NULL;
}

static void
gxml_dom_element_real_create_stream_async_data_free (gpointer _data)
{
	GxmlDomElementCreateStreamAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlDomElementCreateStreamAsyncData, _data_);
}

static void
gxml_dom_element_real_create_stream_async (GXmlDomElement* self,
                                           GCancellable* cancellable,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	GxmlDomElementCreateStreamAsyncData* _data_;
	GXmlDomElement* _tmp0_;
	GCancellable* _tmp1_;
	_data_ = g_slice_new0 (GxmlDomElementCreateStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_element_real_create_stream_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	gxml_dom_element_real_create_stream_async_co (_data_);
}

static GInputStream*
gxml_dom_element_real_create_stream_finish (GXmlDomElement* self,
                                            GAsyncResult* _res_,
                                            GError** error)
{
	GInputStream* result;
	GxmlDomElementCreateStreamAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

/**
   * Creates an {@link GLib.InputStream} to write a string representation
   * in XML of {@link GXml.Element} using node's {@link GXml.Document}
   */
static void
gxml_dom_element_create_stream_async_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	GxmlDomElementCreateStreamAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_dom_element_real_create_stream_async_co (_data_);
}

static gboolean
gxml_dom_element_real_create_stream_async_co (GxmlDomElementCreateStreamAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) _data_->self);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_state_ = 1;
	gxml_dom_document_create_stream_async (_data_->_tmp2_, NULL, gxml_dom_element_create_stream_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = gxml_dom_document_create_stream_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp0_ = _data_->_tmp3_;
	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_->_tmp4_ = _data_->_tmp0_;
	_data_->_tmp0_ = NULL;
	_data_->result = _data_->_tmp4_;
	_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;
}

void
gxml_dom_element_create_stream_async (GXmlDomElement* self,
                                      GCancellable* cancellable,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->create_stream_async) {
		_iface_->create_stream_async (self, cancellable, _callback_, _user_data_);
	}
}

GInputStream*
gxml_dom_element_create_stream_finish (GXmlDomElement* self,
                                       GAsyncResult* _res_,
                                       GError** error)
{
	GXmlDomElementIface* _iface_;
	_iface_ = GXML_DOM_ELEMENT_GET_INTERFACE (self);
	if (_iface_->create_stream_finish) {
		return _iface_->create_stream_finish (self, _res_, error);
	}
	return NULL;
}

static void
gxml_dom_element_default_init (GXmlDomElementIface * iface,
                               gpointer iface_data)
{
	/**
	   * Returns default namespace's uri defined in node or first found.
	   */
	g_object_interface_install_property (iface, g_param_spec_string ("namespace-uri", "namespace-uri", "namespace-uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	   * Returns default namespace's prefix defined in node or first found.
	   */
	g_object_interface_install_property (iface, g_param_spec_string ("prefix", "prefix", "prefix", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("local-name", "local-name", "local-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("tag-name", "tag-name", "tag-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("class-name", "class-name", "class-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_interface_install_property (iface, g_param_spec_object ("class-list", "class-list", "class-list", GXML_TYPE_DOM_TOKEN_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_object ("attributes", "attributes", "attributes", GXML_TYPE_DOM_NAMED_NODE_MAP, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	iface->matches = gxml_dom_element_real_matches;
	iface->read_from_uri = gxml_dom_element_real_read_from_uri;
	iface->read_from_uri_async = gxml_dom_element_real_read_from_uri_async;
	iface->read_from_uri_finish = gxml_dom_element_real_read_from_uri_finish;
	iface->read_from_file = gxml_dom_element_real_read_from_file;
	iface->read_from_file_async = gxml_dom_element_real_read_from_file_async;
	iface->read_from_file_finish = gxml_dom_element_real_read_from_file_finish;
	iface->read_from_stream = gxml_dom_element_real_read_from_stream;
	iface->read_from_stream_async = gxml_dom_element_real_read_from_stream_async;
	iface->read_from_stream_finish = gxml_dom_element_real_read_from_stream_finish;
	iface->read_from_string = gxml_dom_element_real_read_from_string;
	iface->read_from_string_async = gxml_dom_element_real_read_from_string_async;
	iface->read_from_string_finish = gxml_dom_element_real_read_from_string_finish;
	iface->write_string = gxml_dom_element_real_write_string;
	iface->write_string_async = gxml_dom_element_real_write_string_async;
	iface->write_string_finish = gxml_dom_element_real_write_string_finish;
	iface->write_file = gxml_dom_element_real_write_file;
	iface->write_file_async = gxml_dom_element_real_write_file_async;
	iface->write_file_finish = gxml_dom_element_real_write_file_finish;
	iface->write_stream = gxml_dom_element_real_write_stream;
	iface->write_stream_async = gxml_dom_element_real_write_stream_async;
	iface->write_stream_finish = gxml_dom_element_real_write_stream_finish;
	iface->create_stream = gxml_dom_element_real_create_stream;
	iface->create_stream_async = gxml_dom_element_real_create_stream_async;
	iface->create_stream_finish = gxml_dom_element_real_create_stream_finish;
}

static GType
gxml_dom_element_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlDomElementIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_dom_element_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gxml_dom_element_type_id;
	gxml_dom_element_type_id = g_type_register_static (G_TYPE_INTERFACE, "GXmlDomElement", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gxml_dom_element_type_id, G_TYPE_OBJECT);
	g_type_interface_add_prerequisite (gxml_dom_element_type_id, GXML_TYPE_DOM_NODE);
	g_type_interface_add_prerequisite (gxml_dom_element_type_id, GXML_TYPE_DOM_CHILD_NODE);
	g_type_interface_add_prerequisite (gxml_dom_element_type_id, GXML_TYPE_DOM_NON_DOCUMENT_TYPE_CHILD_NODE);
	g_type_interface_add_prerequisite (gxml_dom_element_type_id, GXML_TYPE_DOM_PARENT_NODE);
	return gxml_dom_element_type_id;
}

GType
gxml_dom_element_get_type (void)
{
	static volatile gsize gxml_dom_element_type_id__once = 0;
	if (g_once_init_enter (&gxml_dom_element_type_id__once)) {
		GType gxml_dom_element_type_id;
		gxml_dom_element_type_id = gxml_dom_element_get_type_once ();
		g_once_init_leave (&gxml_dom_element_type_id__once, gxml_dom_element_type_id);
	}
	return gxml_dom_element_type_id__once;
}

static GXmlDomElement*
gxml_dom_element_list_real_get_element (GXmlDomHTMLCollection* base,
                                        gint index)
{
	GXmlDomElementList * self;
	gpointer _tmp0_;
	GXmlDomElement* result;
	self = (GXmlDomElementList*) base;
	_tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self, index);
	result = G_TYPE_CHECK_INSTANCE_CAST ((GXmlDomElement*) _tmp0_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement);
	return result;
}

GXmlDomElementList*
gxml_dom_element_list_construct (GType object_type)
{
	GXmlDomElementList * self = NULL;
	self = (GXmlDomElementList*) gee_array_list_construct (object_type, GXML_TYPE_DOM_ELEMENT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return self;
}

GXmlDomElementList*
gxml_dom_element_list_new (void)
{
	return gxml_dom_element_list_construct (GXML_TYPE_DOM_ELEMENT_LIST);
}

static void
gxml_dom_element_list_class_init (GXmlDomElementListClass * klass,
                                  gpointer klass_data)
{
	gxml_dom_element_list_parent_class = g_type_class_peek_parent (klass);
}

static void
gxml_dom_element_list_gxml_dom_html_collection_interface_init (GXmlDomHTMLCollectionIface * iface,
                                                               gpointer iface_data)
{
	gxml_dom_element_list_gxml_dom_html_collection_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_element = (GXmlDomElement* (*) (GXmlDomHTMLCollection*, gint)) gxml_dom_element_list_real_get_element;
}

static void
gxml_dom_element_list_instance_init (GXmlDomElementList * self,
                                     gpointer klass)
{
}

static GType
gxml_dom_element_list_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlDomElementListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_dom_element_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlDomElementList), 0, (GInstanceInitFunc) gxml_dom_element_list_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_html_collection_info = { (GInterfaceInitFunc) gxml_dom_element_list_gxml_dom_html_collection_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_dom_element_list_type_id;
	gxml_dom_element_list_type_id = g_type_register_static (GEE_TYPE_ARRAY_LIST, "GXmlDomElementList", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_dom_element_list_type_id, GXML_TYPE_DOM_HTML_COLLECTION, &gxml_dom_html_collection_info);
	return gxml_dom_element_list_type_id;
}

GType
gxml_dom_element_list_get_type (void)
{
	static volatile gsize gxml_dom_element_list_type_id__once = 0;
	if (g_once_init_enter (&gxml_dom_element_list_type_id__once)) {
		GType gxml_dom_element_list_type_id;
		gxml_dom_element_list_type_id = gxml_dom_element_list_get_type_once ();
		g_once_init_leave (&gxml_dom_element_list_type_id__once, gxml_dom_element_list_type_id);
	}
	return gxml_dom_element_list_type_id__once;
}

