/* Element.c generated by valac 0.56.19, the Vala compiler
 * generated from Element.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 <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <gee.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include "gxml.h"

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

enum  {
	GXML_ELEMENT_0_PROPERTY,
	GXML_ELEMENT_PREVIOUS_ELEMENT_SIBLING_PROPERTY,
	GXML_ELEMENT_NEXT_ELEMENT_SIBLING_PROPERTY,
	GXML_ELEMENT_CHILDREN_PROPERTY,
	GXML_ELEMENT_FIRST_ELEMENT_CHILD_PROPERTY,
	GXML_ELEMENT_LAST_ELEMENT_CHILD_PROPERTY,
	GXML_ELEMENT_CHILD_ELEMENT_COUNT_PROPERTY,
	GXML_ELEMENT_NAMESPACE_URI_PROPERTY,
	GXML_ELEMENT_PREFIX_PROPERTY,
	GXML_ELEMENT_LOCAL_NAME_PROPERTY,
	GXML_ELEMENT_TAG_NAME_PROPERTY,
	GXML_ELEMENT_ID_PROPERTY,
	GXML_ELEMENT_CLASS_NAME_PROPERTY,
	GXML_ELEMENT_CLASS_LIST_PROPERTY,
	GXML_ELEMENT_ATTRIBUTES_PROPERTY,
	GXML_ELEMENT_PARSE_CHILDREN_PROPERTY,
	GXML_ELEMENT_UNPARSED_PROPERTY,
	GXML_ELEMENT_READ_BUFFER_PROPERTY,
	GXML_ELEMENT_NUM_PROPERTIES
};
static GParamSpec* gxml_element_properties[GXML_ELEMENT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _GxmlElementReadFromFileAsyncData GxmlElementReadFromFileAsyncData;
typedef struct _GxmlElementReadFromStreamAsyncData GxmlElementReadFromStreamAsyncData;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _GxmlElementReadFromStringAsyncData GxmlElementReadFromStringAsyncData;
typedef struct _GxmlElementWriteStringAsyncData GxmlElementWriteStringAsyncData;
typedef struct _GxmlElementWriteFileAsyncData GxmlElementWriteFileAsyncData;
typedef struct _GxmlElementWriteStreamAsyncData GxmlElementWriteStreamAsyncData;
typedef struct _GxmlElementCreateStreamAsyncData GxmlElementCreateStreamAsyncData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_thread_pool_free0(var) ((var == NULL) ? NULL : (var = (g_thread_pool_free (var, FALSE, TRUE), NULL)))
typedef struct _GxmlElementParseBufferAsyncData GxmlElementParseBufferAsyncData;
enum  {
	GXML_ELEMENT_ATTRIBUTES_0_PROPERTY,
	GXML_ELEMENT_ATTRIBUTES_LENGTH_PROPERTY,
	GXML_ELEMENT_ATTRIBUTES_NUM_PROPERTIES
};
static GParamSpec* gxml_element_attributes_properties[GXML_ELEMENT_ATTRIBUTES_NUM_PROPERTIES];
#define _g_param_spec_unref0(var) ((var == NULL) ? NULL : (var = (g_param_spec_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

struct _GXmlElementPrivate {
	gchar* _id;
	gboolean _parse_children;
	gchar* _unparsed;
	GMemoryOutputStream* _read_buffer;
	GThreadPool* pool;
};

struct _GxmlElementReadFromFileAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlElement* self;
	GFile* f;
	GCancellable* cancellable;
	GXmlXParser* parser;
	GXmlXParser* _tmp0_;
	GError* _inner_error0_;
};

struct _GxmlElementReadFromStreamAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlElement* self;
	GInputStream* istream;
	GCancellable* cancellable;
	GXmlXParser* parser;
	GXmlXParser* _tmp0_;
	GError* _inner_error0_;
};

struct _GxmlElementReadFromStringAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlElement* self;
	gchar* str;
	GCancellable* cancellable;
	GXmlXParser* parser;
	GXmlXParser* _tmp0_;
	GError* _inner_error0_;
};

struct _GxmlElementWriteStringAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlElement* self;
	GCancellable* cancellable;
	gchar* result;
	GXmlXParser* parser;
	GXmlXParser* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GError* _inner_error0_;
};

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

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

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

struct _GxmlElementParseBufferAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlElement* self;
	GMemoryOutputStream* _tmp0_;
	guint nth;
	GThreadPool* _tmp1_;
	GThreadPool* _tmp2_;
	GThreadPool* _tmp3_;
	GXmlDomNodeList* _n_list;
	GXmlDomNodeList* _tmp4_;
	GXmlDomNodeList* _tmp5_;
	gint _n_size;
	GXmlDomNodeList* _tmp6_;
	gint _tmp7_;
	gint _tmp8_;
	gint _n_index;
	gint _tmp9_;
	gint _tmp10_;
	GXmlDomNode* n;
	GXmlDomNodeList* _tmp11_;
	gpointer _tmp12_;
	GXmlDomNode* _tmp13_;
	GThreadPool* _tmp14_;
	GXmlDomNode* _tmp15_;
	GXmlElement* _tmp16_;
	GMemoryOutputStream* _tmp17_;
	void* _tmp18_;
	void* _tmp19_;
	GError* _inner_error0_;
};

struct _GXmlElementAttributesPrivate {
	GeeTreeMap* order;
};

static gint GXmlElement_private_offset;
static gpointer gxml_element_parent_class = NULL;
static gint GXmlElementAttributes_private_offset;
static gpointer gxml_element_attributes_parent_class = NULL;
static GXmlDomNamedNodeMapIface * gxml_element_attributes_gxml_dom_named_node_map_parent_iface = NULL;
static GXmlDomChildNodeIface * gxml_element_gxml_dom_child_node_parent_iface = NULL;
static GXmlDomNonDocumentTypeChildNodeIface * gxml_element_gxml_dom_non_document_type_child_node_parent_iface = NULL;
static GXmlDomParentNodeIface * gxml_element_gxml_dom_parent_node_parent_iface = NULL;
static GXmlDomElementIface * gxml_element_gxml_dom_element_parent_iface = NULL;
static GXmlObjectIface * gxml_element_gxml_object_parent_iface = NULL;

static void gxml_element_real_read_from_file (GXmlDomElement* base,
                                       GFile* f,
                                       GCancellable* cancellable,
                                       GError** error);
static void gxml_element_real_read_from_file_async_data_free (gpointer _data);
static void gxml_element_real_read_from_file_async (GXmlDomElement* base,
                                             GFile* f,
                                             GCancellable* cancellable,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
static gboolean gxml_element_real_read_from_file_async_co (GxmlElementReadFromFileAsyncData* _data_);
static void gxml_element_read_from_file_async_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_);
static void gxml_element_real_read_from_stream (GXmlDomElement* base,
                                         GInputStream* istream,
                                         GCancellable* cancellable,
                                         GError** error);
static void gxml_element_real_read_from_stream_async_data_free (gpointer _data);
static void gxml_element_real_read_from_stream_async (GXmlDomElement* base,
                                               GInputStream* istream,
                                               GCancellable* cancellable,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static gboolean gxml_element_real_read_from_stream_async_co (GxmlElementReadFromStreamAsyncData* _data_);
static void gxml_element_read_from_stream_async_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static void gxml_element_real_read_from_string (GXmlDomElement* base,
                                         const gchar* str,
                                         GCancellable* cancellable,
                                         GError** error);
static void gxml_element_real_read_from_string_async_data_free (gpointer _data);
static void gxml_element_real_read_from_string_async (GXmlDomElement* base,
                                               const gchar* str,
                                               GCancellable* cancellable,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static gboolean gxml_element_real_read_from_string_async_co (GxmlElementReadFromStringAsyncData* _data_);
static void gxml_element_read_from_string_async_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_);
static gchar* gxml_element_real_write_string (GXmlDomElement* base,
                                       GCancellable* cancellable,
                                       GError** error);
static void gxml_element_real_write_string_async_data_free (gpointer _data);
static void gxml_element_real_write_string_async (GXmlDomElement* base,
                                           GCancellable* cancellable,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static gboolean gxml_element_real_write_string_async_co (GxmlElementWriteStringAsyncData* _data_);
static void gxml_element_write_string_async_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
static void gxml_element_real_write_file (GXmlDomElement* base,
                                   GFile* f,
                                   GCancellable* cancellable,
                                   GError** error);
static void gxml_element_real_write_file_async_data_free (gpointer _data);
static void gxml_element_real_write_file_async (GXmlDomElement* base,
                                         GFile* f,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_);
static gboolean gxml_element_real_write_file_async_co (GxmlElementWriteFileAsyncData* _data_);
static void gxml_element_write_file_async_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void gxml_element_real_write_stream (GXmlDomElement* base,
                                     GOutputStream* stream,
                                     GError** error);
static void gxml_element_real_write_stream_async_data_free (gpointer _data);
static void gxml_element_real_write_stream_async (GXmlDomElement* base,
                                           GOutputStream* stream,
                                           GCancellable* cancellable,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
static gboolean gxml_element_real_write_stream_async_co (GxmlElementWriteStreamAsyncData* _data_);
static void gxml_element_write_stream_async_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_);
static GInputStream* gxml_element_real_create_stream (GXmlDomElement* base,
                                               GError** error);
static void gxml_element_real_create_stream_async_data_free (gpointer _data);
static void gxml_element_real_create_stream_async (GXmlDomElement* base,
                                            GCancellable* cancellable,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static gboolean gxml_element_real_create_stream_async_co (GxmlElementCreateStreamAsyncData* _data_);
static void gxml_element_create_stream_async_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
static void gxml_element_real_remove (GXmlDomChildNode* base);
static GXmlDomNodeList* gxml_element_real_query_selector_all (GXmlDomParentNode* base,
                                                       const gchar* selectors,
                                                       GError** error);
static gchar* gxml_element_real_get_attribute (GXmlDomElement* base,
                                        const gchar* name);
static gchar* gxml_element_real_get_attribute_ns (GXmlDomElement* base,
                                           const gchar* namespace_uri,
                                           const gchar* local_name);
static void gxml_element_real_set_attribute (GXmlDomElement* base,
                                      const gchar* name,
                                      const gchar* value,
                                      GError** error);
static void gxml_element_real_set_attribute_ns (GXmlDomElement* base,
                                         const gchar* namespace_uri,
                                         const gchar* name,
                                         const gchar* value,
                                         GError** error);
static void gxml_element_real_remove_attribute (GXmlDomElement* base,
                                         const gchar* name);
static void gxml_element_real_remove_attribute_ns (GXmlDomElement* base,
                                            const gchar* namespace_uri,
                                            const gchar* local_name);
static gboolean gxml_element_real_has_attribute (GXmlDomElement* base,
                                          const gchar* name);
static gboolean gxml_element_real_has_attribute_ns (GXmlDomElement* base,
                                             const gchar* namespace_uri,
                                             const gchar* local_name);
static GXmlDomHTMLCollection* gxml_element_real_get_elements_by_tag_name (GXmlDomElement* base,
                                                                   const gchar* local_name);
static GXmlDomHTMLCollection* gxml_element_real_get_elements_by_tag_name_ns (GXmlDomElement* base,
                                                                      const gchar* namespace,
                                                                      const gchar* local_name);
static GXmlDomHTMLCollection* gxml_element_real_get_elements_by_class_name (GXmlDomElement* base,
                                                                     const gchar* class_names);
static void _vala_array_add1 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add2 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void gxml_element_parse_buffer_async_data_free (gpointer _data);
static gboolean gxml_element_parse_buffer_async_co (GxmlElementParseBufferAsyncData* _data_);
static void __lambda5_ (GXmlElement* self,
                 GXmlElement* e);
static void ___lambda5__gfunc (gpointer data,
                        gpointer self);
static GXmlDomNode* gxml_element_attributes_real_item (GXmlDomNamedNodeMap* base,
                                                gint index);
static GXmlDomNode* gxml_element_attributes_real_get_named_item (GXmlDomNamedNodeMap* base,
                                                          const gchar* name);
static GXmlDomNode* gxml_element_attributes_real_set_named_item (GXmlDomNamedNodeMap* base,
                                                          GXmlDomNode* node,
                                                          GError** error);
static GXmlDomNode* gxml_element_attributes_real_remove_named_item (GXmlDomNamedNodeMap* base,
                                                             const gchar* name,
                                                             GError** error);
static glong gxml_element_attributes_index_of (GXmlElementAttributes* self,
                                        const gchar* name);
static GXmlDomNode* gxml_element_attributes_real_remove_named_item_ns (GXmlDomNamedNodeMap* base,
                                                                const gchar* namespace_uri,
                                                                const gchar* local_name,
                                                                GError** error);
static GXmlDomNode* gxml_element_attributes_real_get_named_item_ns (GXmlDomNamedNodeMap* base,
                                                             const gchar* namespace_uri,
                                                             const gchar* local_name,
                                                             GError** error);
static GXmlDomNode* gxml_element_attributes_real_set_named_item_ns (GXmlDomNamedNodeMap* base,
                                                             GXmlDomNode* node,
                                                             GError** error);
static void gxml_element_attributes_finalize (GObject * obj);
static GType gxml_element_attributes_get_type_once (void);
static void _vala_gxml_element_attributes_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static GObject * gxml_element_constructor (GType type,
                                    guint n_construct_properties,
                                    GObjectConstructParam * construct_properties);
static void _gxml_element___lambda6_ (GXmlElement* self,
                               GParamSpec* pspec);
static void __gxml_element___lambda6__g_object_notify (GObject* _sender,
                                                GParamSpec* pspec,
                                                gpointer self);
static void gxml_element_finalize (GObject * obj);
static GType gxml_element_get_type_once (void);
static void _vala_gxml_element_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec);
static void _vala_gxml_element_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
gxml_element_get_instance_private (GXmlElement* self)
{
	return G_STRUCT_MEMBER_P (self, GXmlElement_private_offset);
}

/**
   * Parses an XML file, deserializing it over {@link GXml.Element}.
   */
static void
gxml_element_real_read_from_file (GXmlDomElement* base,
                                  GFile* f,
                                  GCancellable* cancellable,
                                  GError** error)
{
	GXmlElement * self;
	GXmlXParser* parser = NULL;
	GXmlXParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	self = (GXmlElement*) base;
	g_return_if_fail (f != NULL);
	_tmp0_ = gxml_xparser_new ((GXmlDomNode*) self);
	parser = _tmp0_;
	gxml_parser_set_cancellable ((GXmlParser*) parser, cancellable);
	gxml_parser_read_file ((GXmlParser*) parser, f, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return;
	}
	_g_object_unref0 (parser);
}

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

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

static void
gxml_element_real_read_from_file_async (GXmlDomElement* base,
                                        GFile* f,
                                        GCancellable* cancellable,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	GXmlElement * self;
	GxmlElementReadFromFileAsyncData* _data_;
	GXmlElement* _tmp0_;
	GFile* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (f != NULL);
	self = (GXmlElement*) base;
	_data_ = g_slice_new0 (GxmlElementReadFromFileAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_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_element_real_read_from_file_async_co (_data_);
}

static void
gxml_element_read_from_file_finish (GXmlDomElement* base,
                                    GAsyncResult* _res_,
                                    GError** error)
{
	GxmlElementReadFromFileAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Parses asynchronically an XML file, deserializing it over {@link GXml.Element}.
   */
static void
gxml_element_read_from_file_async_ready (GObject* source_object,
                                         GAsyncResult* _res_,
                                         gpointer _user_data_)
{
	GxmlElementReadFromFileAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_element_real_read_from_file_async_co (_data_);
}

static gboolean
gxml_element_real_read_from_file_async_co (GxmlElementReadFromFileAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_xparser_new ((GXmlDomNode*) _data_->self);
	_data_->parser = _data_->_tmp0_;
	gxml_parser_set_cancellable ((GXmlParser*) _data_->parser, _data_->cancellable);
	_data_->_state_ = 1;
	gxml_parser_read_file_async ((GXmlParser*) _data_->parser, _data_->f, gxml_element_read_from_file_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_parser_read_file_finish ((GXmlParser*) _data_->parser, _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_->parser);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->parser);
	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;
}

/**
   * Parses an XML over a {@link GLib.InputStream}, deserializing it over {@link GXml.Element}.
   */
static void
gxml_element_real_read_from_stream (GXmlDomElement* base,
                                    GInputStream* istream,
                                    GCancellable* cancellable,
                                    GError** error)
{
	GXmlElement * self;
	GXmlXParser* parser = NULL;
	GXmlXParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	self = (GXmlElement*) base;
	g_return_if_fail (istream != NULL);
	_tmp0_ = gxml_xparser_new ((GXmlDomNode*) self);
	parser = _tmp0_;
	gxml_parser_set_cancellable ((GXmlParser*) parser, cancellable);
	gxml_parser_read_stream ((GXmlParser*) parser, istream, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return;
	}
	_g_object_unref0 (parser);
}

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

static void
gxml_element_real_read_from_stream_async (GXmlDomElement* base,
                                          GInputStream* istream,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	GXmlElement * self;
	GxmlElementReadFromStreamAsyncData* _data_;
	GXmlElement* _tmp0_;
	GInputStream* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (istream != NULL);
	self = (GXmlElement*) base;
	_data_ = g_slice_new0 (GxmlElementReadFromStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_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_element_real_read_from_stream_async_co (_data_);
}

static void
gxml_element_read_from_stream_finish (GXmlDomElement* base,
                                      GAsyncResult* _res_,
                                      GError** error)
{
	GxmlElementReadFromStreamAsyncData* _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 void
gxml_element_read_from_stream_async_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	GxmlElementReadFromStreamAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_element_real_read_from_stream_async_co (_data_);
}

static gboolean
gxml_element_real_read_from_stream_async_co (GxmlElementReadFromStreamAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_xparser_new ((GXmlDomNode*) _data_->self);
	_data_->parser = _data_->_tmp0_;
	gxml_parser_set_cancellable ((GXmlParser*) _data_->parser, _data_->cancellable);
	_data_->_state_ = 1;
	gxml_parser_read_stream_async ((GXmlParser*) _data_->parser, _data_->istream, gxml_element_read_from_stream_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_parser_read_stream_finish ((GXmlParser*) _data_->parser, _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_->parser);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->parser);
	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;
}

/**
   * Parses an XML string, deserializing it over {@link GXml.Element}.
   */
static void
gxml_element_real_read_from_string (GXmlDomElement* base,
                                    const gchar* str,
                                    GCancellable* cancellable,
                                    GError** error)
{
	GXmlElement * self;
	GXmlXParser* parser = NULL;
	GXmlXParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	self = (GXmlElement*) base;
	g_return_if_fail (str != NULL);
	_tmp0_ = gxml_xparser_new ((GXmlDomNode*) self);
	parser = _tmp0_;
	gxml_parser_set_cancellable ((GXmlParser*) parser, cancellable);
	gxml_parser_read_string ((GXmlParser*) parser, str, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return;
	}
	_g_object_unref0 (parser);
}

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

static void
gxml_element_real_read_from_string_async (GXmlDomElement* base,
                                          const gchar* str,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	GXmlElement * self;
	GxmlElementReadFromStringAsyncData* _data_;
	GXmlElement* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (str != NULL);
	self = (GXmlElement*) base;
	_data_ = g_slice_new0 (GxmlElementReadFromStringAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_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_element_real_read_from_string_async_co (_data_);
}

static void
gxml_element_read_from_string_finish (GXmlDomElement* base,
                                      GAsyncResult* _res_,
                                      GError** error)
{
	GxmlElementReadFromStringAsyncData* _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 void
gxml_element_read_from_string_async_ready (GObject* source_object,
                                           GAsyncResult* _res_,
                                           gpointer _user_data_)
{
	GxmlElementReadFromStringAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_element_real_read_from_string_async_co (_data_);
}

static gboolean
gxml_element_real_read_from_string_async_co (GxmlElementReadFromStringAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_xparser_new ((GXmlDomNode*) _data_->self);
	_data_->parser = _data_->_tmp0_;
	gxml_parser_set_cancellable ((GXmlParser*) _data_->parser, _data_->cancellable);
	_data_->_state_ = 1;
	gxml_parser_read_string_async ((GXmlParser*) _data_->parser, _data_->str, gxml_element_read_from_string_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_parser_read_string_finish ((GXmlParser*) _data_->parser, _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_->parser);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->parser);
	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;
}

/**
   * Serialize {@link GXml.Element} to a string.
   */
static gchar*
gxml_element_real_write_string (GXmlDomElement* base,
                                GCancellable* cancellable,
                                GError** error)
{
	GXmlElement * self;
	GXmlXParser* parser = NULL;
	GXmlXParser* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	self = (GXmlElement*) base;
	_tmp0_ = gxml_xparser_new ((GXmlDomNode*) self);
	parser = _tmp0_;
	gxml_parser_set_cancellable ((GXmlParser*) parser, cancellable);
	_tmp2_ = gxml_parser_write_string ((GXmlParser*) parser, &_inner_error0_);
	_tmp1_ = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return NULL;
	}
	_tmp3_ = _tmp1_;
	_tmp1_ = NULL;
	result = _tmp3_;
	_g_free0 (_tmp1_);
	_g_object_unref0 (parser);
	return result;
}

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

static void
gxml_element_real_write_string_async (GXmlDomElement* base,
                                      GCancellable* cancellable,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	GXmlElement * self;
	GxmlElementWriteStringAsyncData* _data_;
	GXmlElement* _tmp0_;
	GCancellable* _tmp1_;
	self = (GXmlElement*) base;
	_data_ = g_slice_new0 (GxmlElementWriteStringAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_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_element_real_write_string_async_co (_data_);
}

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

/**
   * Serialize asynchronically {@link GXml.Element} to a string.
   */
static void
gxml_element_write_string_async_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	GxmlElementWriteStringAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_element_real_write_string_async_co (_data_);
}

static gboolean
gxml_element_real_write_string_async_co (GxmlElementWriteStringAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_xparser_new ((GXmlDomNode*) _data_->self);
	_data_->parser = _data_->_tmp0_;
	gxml_parser_set_cancellable ((GXmlParser*) _data_->parser, _data_->cancellable);
	_data_->_state_ = 1;
	gxml_parser_write_string_async ((GXmlParser*) _data_->parser, gxml_element_write_string_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = gxml_parser_write_string_finish ((GXmlParser*) _data_->parser, _data_->_res_, &_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_unref0 (_data_->parser);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = _data_->_tmp1_;
	_data_->_tmp1_ = NULL;
	_data_->result = _data_->_tmp3_;
	_g_free0 (_data_->_tmp1_);
	_g_object_unref0 (_data_->parser);
	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;
}

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

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

static void
gxml_element_real_write_file_async (GXmlDomElement* base,
                                    GFile* f,
                                    GCancellable* cancellable,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	GXmlElement * self;
	GxmlElementWriteFileAsyncData* _data_;
	GXmlElement* _tmp0_;
	GFile* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (f != NULL);
	self = (GXmlElement*) base;
	_data_ = g_slice_new0 (GxmlElementWriteFileAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_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_element_real_write_file_async_co (_data_);
}

static void
gxml_element_write_file_finish (GXmlDomElement* base,
                                GAsyncResult* _res_,
                                GError** error)
{
	GxmlElementWriteFileAsyncData* _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_element_write_file_async_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	GxmlElementWriteFileAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_element_real_write_file_async_co (_data_);
}

static gboolean
gxml_element_real_write_file_async_co (GxmlElementWriteFileAsyncData* _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 ((GXmlDomDocument*) G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, GXML_TYPE_DOCUMENT, GXmlDocument), _data_->f, NULL, gxml_element_write_file_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_dom_document_write_file_finish ((GXmlDomDocument*) G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, GXML_TYPE_DOCUMENT, GXmlDocument), _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;
}

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

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

static void
gxml_element_real_write_stream_async (GXmlDomElement* base,
                                      GOutputStream* stream,
                                      GCancellable* cancellable,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	GXmlElement * self;
	GxmlElementWriteStreamAsyncData* _data_;
	GXmlElement* _tmp0_;
	GOutputStream* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (stream != NULL);
	self = (GXmlElement*) base;
	_data_ = g_slice_new0 (GxmlElementWriteStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_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_element_real_write_stream_async_co (_data_);
}

static void
gxml_element_write_stream_finish (GXmlDomElement* base,
                                  GAsyncResult* _res_,
                                  GError** error)
{
	GxmlElementWriteStreamAsyncData* _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_element_write_stream_async_ready (GObject* source_object,
                                       GAsyncResult* _res_,
                                       gpointer _user_data_)
{
	GxmlElementWriteStreamAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_element_real_write_stream_async_co (_data_);
}

static gboolean
gxml_element_real_write_stream_async_co (GxmlElementWriteStreamAsyncData* _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 ((GXmlDomDocument*) G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, GXML_TYPE_DOCUMENT, GXmlDocument), _data_->stream, NULL, gxml_element_write_stream_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_dom_document_write_stream_finish ((GXmlDomDocument*) G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp1_, GXML_TYPE_DOCUMENT, GXmlDocument), _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;
}

/**
   * 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_element_real_create_stream (GXmlDomElement* base,
                                 GError** error)
{
	GXmlElement * self;
	GInputStream* _tmp0_ = NULL;
	GXmlDomDocument* _tmp1_;
	GXmlDomDocument* _tmp2_;
	GInputStream* _tmp3_;
	GInputStream* _tmp4_;
	GError* _inner_error0_ = NULL;
	GInputStream* result;
	self = (GXmlElement*) base;
	_tmp1_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = gxml_dom_document_create_stream ((GXmlDomDocument*) G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GXML_TYPE_DOCUMENT, GXmlDocument), &_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;
}

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

static void
gxml_element_real_create_stream_async (GXmlDomElement* base,
                                       GCancellable* cancellable,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	GXmlElement * self;
	GxmlElementCreateStreamAsyncData* _data_;
	GXmlElement* _tmp0_;
	GCancellable* _tmp1_;
	self = (GXmlElement*) base;
	_data_ = g_slice_new0 (GxmlElementCreateStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_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_element_real_create_stream_async_co (_data_);
}

static GInputStream*
gxml_element_create_stream_finish (GXmlDomElement* base,
                                   GAsyncResult* _res_,
                                   GError** error)
{
	GInputStream* result;
	GxmlElementCreateStreamAsyncData* _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_element_create_stream_async_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	GxmlElementCreateStreamAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_element_real_create_stream_async_co (_data_);
}

static gboolean
gxml_element_real_create_stream_async_co (GxmlElementCreateStreamAsyncData* _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 ((GXmlDomDocument*) G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp2_, GXML_TYPE_DOCUMENT, GXmlDocument), NULL, gxml_element_create_stream_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = gxml_dom_document_create_stream_finish ((GXmlDomDocument*) G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp2_, GXML_TYPE_DOCUMENT, GXmlDocument), _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;
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gchar* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

gchar*
gxml_element_lookup_prefix (GXmlElement* self,
                            const gchar* nspace)
{
	const gchar* _tmp0_;
	const gchar* _tmp3_;
	GQuark _tmp5_ = 0U;
	static GQuark _tmp4_label0 = 0;
	static GQuark _tmp4_label1 = 0;
	static GQuark _tmp4_label2 = 0;
	static GQuark _tmp4_label3 = 0;
	static GQuark _tmp4_label4 = 0;
	static GQuark _tmp4_label5 = 0;
	static GQuark _tmp4_label6 = 0;
	static GQuark _tmp4_label7 = 0;
	static GQuark _tmp4_label8 = 0;
	static GQuark _tmp4_label9 = 0;
	static GQuark _tmp4_label10 = 0;
	static GQuark _tmp4_label11 = 0;
	static GQuark _tmp4_label12 = 0;
	static GQuark _tmp4_label13 = 0;
	GXmlDomNode* _tmp42_;
	GXmlDomNode* _tmp43_;
	GXmlDomNode* _tmp44_;
	gboolean _tmp45_;
	GXmlDomNode* _tmp46_;
	GXmlDomNode* _tmp47_;
	GXmlDomNode* _tmp48_;
	gchar* _tmp49_;
	gchar* _tmp50_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->_namespace_uri;
	if (g_strcmp0 (_tmp0_, nspace) == 0) {
		const gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = ((GXmlNode*) self)->_prefix;
		_tmp2_ = g_strdup (_tmp1_);
		result = _tmp2_;
		return result;
	}
	_tmp3_ = nspace;
	_tmp5_ = (NULL == _tmp3_) ? 0 : g_quark_from_string (_tmp3_);
	if ((_tmp5_ == ((0 != _tmp4_label0) ? _tmp4_label0 : (_tmp4_label0 = g_quark_from_static_string ("http://www.w3.org/2000/xmlns/")))) || (_tmp5_ == ((0 != _tmp4_label1) ? _tmp4_label1 : (_tmp4_label1 = g_quark_from_static_string ("http://www.w3.org/2000/xmlns"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp6_;
				_tmp6_ = g_strdup ("xmlns");
				result = _tmp6_;
				return result;
			}
		}
	} else if ((_tmp5_ == ((0 != _tmp4_label2) ? _tmp4_label2 : (_tmp4_label2 = g_quark_from_static_string ("http://www.w3.org/XML/1998/namespace")))) || (_tmp5_ == ((0 != _tmp4_label3) ? _tmp4_label3 : (_tmp4_label3 = g_quark_from_static_string ("http://www.w3.org/XML/1998/namespace/"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp7_;
				_tmp7_ = g_strdup ("xml");
				result = _tmp7_;
				return result;
			}
		}
	} else if ((_tmp5_ == ((0 != _tmp4_label4) ? _tmp4_label4 : (_tmp4_label4 = g_quark_from_static_string ("http://www.w3.org/1999/xhtml")))) || (_tmp5_ == ((0 != _tmp4_label5) ? _tmp4_label5 : (_tmp4_label5 = g_quark_from_static_string ("http://www.w3.org/1999/xhtml/"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp8_;
				_tmp8_ = g_strdup ("html");
				result = _tmp8_;
				return result;
			}
		}
	} else if ((_tmp5_ == ((0 != _tmp4_label6) ? _tmp4_label6 : (_tmp4_label6 = g_quark_from_static_string ("http://www.w3.org/2001/XMLSchema-instance")))) || (_tmp5_ == ((0 != _tmp4_label7) ? _tmp4_label7 : (_tmp4_label7 = g_quark_from_static_string ("http://www.w3.org/2001/XMLSchema-instance/"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp9_;
				_tmp9_ = g_strdup ("xsi");
				result = _tmp9_;
				return result;
			}
		}
	} else if ((_tmp5_ == ((0 != _tmp4_label8) ? _tmp4_label8 : (_tmp4_label8 = g_quark_from_static_string ("http://www.w3.org/2000/svg")))) || (_tmp5_ == ((0 != _tmp4_label9) ? _tmp4_label9 : (_tmp4_label9 = g_quark_from_static_string ("http://www.w3.org/2000/svg/"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp10_;
				_tmp10_ = g_strdup ("svg");
				result = _tmp10_;
				return result;
			}
		}
	} else if ((_tmp5_ == ((0 != _tmp4_label10) ? _tmp4_label10 : (_tmp4_label10 = g_quark_from_static_string ("http://www.w3.org/1998/Math/MathML")))) || (_tmp5_ == ((0 != _tmp4_label11) ? _tmp4_label11 : (_tmp4_label11 = g_quark_from_static_string ("http://www.w3.org/1998/Math/MathML/"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp11_;
				_tmp11_ = g_strdup ("mathml");
				result = _tmp11_;
				return result;
			}
		}
	} else if ((_tmp5_ == ((0 != _tmp4_label12) ? _tmp4_label12 : (_tmp4_label12 = g_quark_from_static_string ("http://www.w3.org/1999/xlink")))) || (_tmp5_ == ((0 != _tmp4_label13) ? _tmp4_label13 : (_tmp4_label13 = g_quark_from_static_string ("http://www.w3.org/1999/xlink/"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp12_;
				_tmp12_ = g_strdup ("xlink");
				result = _tmp12_;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				break;
			}
		}
	}
	{
		GeeIterator* _k_it = NULL;
		GXmlElementAttributes* _tmp13_;
		GeeSet* _tmp14_;
		GeeSet* _tmp15_;
		GeeSet* _tmp16_;
		GeeIterator* _tmp17_;
		GeeIterator* _tmp18_;
		_tmp13_ = self->_attributes;
		_tmp14_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = _tmp15_;
		_tmp17_ = gee_iterable_iterator ((GeeIterable*) _tmp16_);
		_tmp18_ = _tmp17_;
		_g_object_unref0 (_tmp16_);
		_k_it = _tmp18_;
		while (TRUE) {
			GeeIterator* _tmp19_;
			gchar* k = NULL;
			GeeIterator* _tmp20_;
			gpointer _tmp21_;
			const gchar* _tmp22_;
			gchar* ns_uri = NULL;
			GXmlAttr* prop = NULL;
			GXmlElementAttributes* _tmp23_;
			const gchar* _tmp24_;
			gpointer _tmp25_;
			GXmlDomNode* _tmp26_;
			GXmlAttr* _tmp27_;
			GXmlAttr* _tmp28_;
			const gchar* _tmp32_;
			const gchar* _tmp33_;
			_tmp19_ = _k_it;
			if (!gee_iterator_next (_tmp19_)) {
				break;
			}
			_tmp20_ = _k_it;
			_tmp21_ = gee_iterator_get (_tmp20_);
			k = (gchar*) _tmp21_;
			_tmp22_ = k;
			if (!string_contains (_tmp22_, "xmlns")) {
				_g_free0 (k);
				continue;
			}
			ns_uri = NULL;
			_tmp23_ = self->_attributes;
			_tmp24_ = k;
			_tmp25_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp23_, _tmp24_);
			_tmp26_ = (GXmlDomNode*) _tmp25_;
			_tmp27_ = GXML_IS_ATTR (_tmp26_) ? ((GXmlAttr*) _tmp26_) : NULL;
			if (_tmp27_ == NULL) {
				_g_object_unref0 (_tmp26_);
			}
			prop = _tmp27_;
			_tmp28_ = prop;
			if (_tmp28_ != NULL) {
				GXmlAttr* _tmp29_;
				gchar* _tmp30_;
				gchar* _tmp31_;
				_tmp29_ = prop;
				_tmp30_ = gxml_dom_attr_get_value ((GXmlDomAttr*) _tmp29_);
				_tmp31_ = _tmp30_;
				_g_free0 (ns_uri);
				ns_uri = _tmp31_;
			}
			_tmp32_ = ns_uri;
			if (_tmp32_ == NULL) {
				g_warning ("Element.vala:194: %s", _ ("Invalid namespace URI stored in element's attribute"));
				result = NULL;
				_g_object_unref0 (prop);
				_g_free0 (ns_uri);
				_g_free0 (k);
				_g_object_unref0 (_k_it);
				return result;
			}
			_tmp33_ = ns_uri;
			if (g_strcmp0 (_tmp33_, nspace) == 0) {
				const gchar* _tmp34_;
				_tmp34_ = k;
				if (string_contains (_tmp34_, ":")) {
					gchar** sa = NULL;
					const gchar* _tmp35_;
					gchar** _tmp36_;
					gchar** _tmp37_;
					gint sa_length1;
					gint _sa_size_;
					gchar** _tmp38_;
					gint _tmp38__length1;
					gchar** _tmp39_;
					gint _tmp39__length1;
					const gchar* _tmp40_;
					gchar* _tmp41_;
					_tmp35_ = k;
					_tmp37_ = _tmp36_ = g_strsplit (_tmp35_, ":", 0);
					sa = _tmp37_;
					sa_length1 = _vala_array_length (_tmp36_);
					_sa_size_ = sa_length1;
					_tmp38_ = sa;
					_tmp38__length1 = sa_length1;
					if (_tmp38__length1 > 2) {
						g_warning ("Element.vala:201: %s", _ ("Invalid attribute name in element's attributes list"));
						result = NULL;
						sa = (_vala_array_free (sa, sa_length1, (GDestroyNotify) g_free), NULL);
						_g_object_unref0 (prop);
						_g_free0 (ns_uri);
						_g_free0 (k);
						_g_object_unref0 (_k_it);
						return result;
					}
					_tmp39_ = sa;
					_tmp39__length1 = sa_length1;
					_tmp40_ = _tmp39_[1];
					_tmp41_ = g_strdup (_tmp40_);
					result = _tmp41_;
					sa = (_vala_array_free (sa, sa_length1, (GDestroyNotify) g_free), NULL);
					_g_object_unref0 (prop);
					_g_free0 (ns_uri);
					_g_free0 (k);
					_g_object_unref0 (_k_it);
					return result;
				}
			}
			_g_object_unref0 (prop);
			_g_free0 (ns_uri);
			_g_free0 (k);
		}
		_g_object_unref0 (_k_it);
	}
	_tmp42_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp43_ = _tmp42_;
	_tmp44_ = _tmp43_;
	_tmp45_ = _tmp44_ == NULL;
	_g_object_unref0 (_tmp44_);
	if (_tmp45_) {
		result = NULL;
		return result;
	}
	_tmp46_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp47_ = _tmp46_;
	_tmp48_ = _tmp47_;
	_tmp49_ = gxml_dom_node_lookup_prefix (_tmp48_, nspace);
	_tmp50_ = _tmp49_;
	_g_object_unref0 (_tmp48_);
	result = _tmp50_;
	return result;
}

gchar*
gxml_element_lookup_namespace_uri (GXmlElement* self,
                                   const gchar* prefix)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	static GQuark _tmp1_label2 = 0;
	static GQuark _tmp1_label3 = 0;
	static GQuark _tmp1_label4 = 0;
	static GQuark _tmp1_label5 = 0;
	static GQuark _tmp1_label6 = 0;
	static GQuark _tmp1_label7 = 0;
	GXmlDomNode* _tmp40_;
	GXmlDomNode* _tmp41_;
	GXmlDomNode* _tmp42_;
	gboolean _tmp43_;
	GXmlDomNode* _tmp44_;
	GXmlDomNode* _tmp45_;
	GXmlDomNode* _tmp46_;
	gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = prefix;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("xmlns")))) {
		switch (0) {
			default:
			{
				gchar* _tmp3_;
				_tmp3_ = g_strdup ("http://www.w3.org/2000/xmlns");
				result = _tmp3_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("xml")))) {
		switch (0) {
			default:
			{
				gchar* _tmp4_;
				_tmp4_ = g_strdup ("http://www.w3.org/XML/1998/namespace");
				result = _tmp4_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("html")))) {
		switch (0) {
			default:
			{
				gchar* _tmp5_;
				_tmp5_ = g_strdup ("http://www.w3.org/1999/xhtml");
				result = _tmp5_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label3) ? _tmp1_label3 : (_tmp1_label3 = g_quark_from_static_string ("xsi")))) {
		switch (0) {
			default:
			{
				gchar* _tmp6_;
				_tmp6_ = g_strdup ("http://www.w3.org/2001/XMLSchema-instance");
				result = _tmp6_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label4) ? _tmp1_label4 : (_tmp1_label4 = g_quark_from_static_string ("svg")))) {
		switch (0) {
			default:
			{
				gchar* _tmp7_;
				_tmp7_ = g_strdup ("http://www.w3.org/2000/svg");
				result = _tmp7_;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label5) ? _tmp1_label5 : (_tmp1_label5 = g_quark_from_static_string ("xlink")))) {
		switch (0) {
			default:
			{
				gchar* _tmp8_;
				_tmp8_ = g_strdup ("http://www.w3.org/1999/xlink");
				result = _tmp8_;
				return result;
			}
		}
	} else if ((_tmp2_ == ((0 != _tmp1_label6) ? _tmp1_label6 : (_tmp1_label6 = g_quark_from_static_string ("mathml")))) || (_tmp2_ == ((0 != _tmp1_label7) ? _tmp1_label7 : (_tmp1_label7 = g_quark_from_static_string ("MathML"))))) {
		switch (0) {
			default:
			{
				gchar* _tmp9_;
				_tmp9_ = g_strdup ("http://www.w3.org/1998/Math/MathML");
				result = _tmp9_;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				break;
			}
		}
	}
	{
		GeeIterator* _k_it = NULL;
		GXmlDomNamedNodeMap* _tmp10_;
		GXmlDomNamedNodeMap* _tmp11_;
		GXmlDomNamedNodeMap* _tmp12_;
		GeeSet* _tmp13_;
		GeeSet* _tmp14_;
		GeeSet* _tmp15_;
		GeeIterator* _tmp16_;
		GeeIterator* _tmp17_;
		_tmp10_ = gxml_dom_element_get_attributes ((GXmlDomElement*) self);
		_tmp11_ = _tmp10_;
		_tmp12_ = _tmp11_;
		_tmp13_ = gee_map_get_keys ((GeeMap*) _tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = _tmp14_;
		_tmp16_ = gee_iterable_iterator ((GeeIterable*) _tmp15_);
		_tmp17_ = _tmp16_;
		_g_object_unref0 (_tmp15_);
		_g_object_unref0 (_tmp12_);
		_k_it = _tmp17_;
		while (TRUE) {
			GeeIterator* _tmp18_;
			gchar* k = NULL;
			GeeIterator* _tmp19_;
			gpointer _tmp20_;
			const gchar* _tmp21_;
			GXmlAttr* p = NULL;
			GXmlElementAttributes* _tmp22_;
			const gchar* _tmp23_;
			gpointer _tmp24_;
			GXmlDomNode* _tmp25_;
			GXmlAttr* _tmp26_;
			gchar* nsp = NULL;
			GXmlAttr* _tmp27_;
			gboolean _tmp31_ = FALSE;
			const gchar* _tmp33_;
			_tmp18_ = _k_it;
			if (!gee_iterator_next (_tmp18_)) {
				break;
			}
			_tmp19_ = _k_it;
			_tmp20_ = gee_iterator_get (_tmp19_);
			k = (gchar*) _tmp20_;
			_tmp21_ = k;
			if (!string_contains (_tmp21_, "xmlns")) {
				_g_free0 (k);
				continue;
			}
			_tmp22_ = self->_attributes;
			_tmp23_ = k;
			_tmp24_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp22_, _tmp23_);
			_tmp25_ = (GXmlDomNode*) _tmp24_;
			_tmp26_ = GXML_IS_ATTR (_tmp25_) ? ((GXmlAttr*) _tmp25_) : NULL;
			if (_tmp26_ == NULL) {
				_g_object_unref0 (_tmp25_);
			}
			p = _tmp26_;
			nsp = NULL;
			_tmp27_ = p;
			if (_tmp27_ != NULL) {
				GXmlAttr* _tmp28_;
				gchar* _tmp29_;
				gchar* _tmp30_;
				_tmp28_ = p;
				_tmp29_ = gxml_dom_attr_get_value ((GXmlDomAttr*) _tmp28_);
				_tmp30_ = _tmp29_;
				_g_free0 (nsp);
				nsp = _tmp30_;
			}
			if (prefix == NULL) {
				const gchar* _tmp32_;
				_tmp32_ = k;
				_tmp31_ = g_strcmp0 (_tmp32_, "xmlns") == 0;
			} else {
				_tmp31_ = FALSE;
			}
			if (_tmp31_) {
				result = nsp;
				_g_object_unref0 (p);
				_g_free0 (k);
				_g_object_unref0 (_k_it);
				return result;
			}
			_tmp33_ = k;
			if (string_contains (_tmp33_, ":")) {
				gchar** sa = NULL;
				const gchar* _tmp34_;
				gchar** _tmp35_;
				gchar** _tmp36_;
				gint sa_length1;
				gint _sa_size_;
				gchar** _tmp37_;
				gint _tmp37__length1;
				gchar** _tmp38_;
				gint _tmp38__length1;
				const gchar* _tmp39_;
				_tmp34_ = k;
				_tmp36_ = _tmp35_ = g_strsplit (_tmp34_, ":", 0);
				sa = _tmp36_;
				sa_length1 = _vala_array_length (_tmp35_);
				_sa_size_ = sa_length1;
				_tmp37_ = sa;
				_tmp37__length1 = sa_length1;
				if (_tmp37__length1 != 2) {
					g_warning ("Element.vala:242: %s", _ ("Invalid attribute name in element's attributes list"));
					result = NULL;
					sa = (_vala_array_free (sa, sa_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (nsp);
					_g_object_unref0 (p);
					_g_free0 (k);
					_g_object_unref0 (_k_it);
					return result;
				}
				_tmp38_ = sa;
				_tmp38__length1 = sa_length1;
				_tmp39_ = _tmp38_[1];
				if (g_strcmp0 (prefix, _tmp39_) == 0) {
					result = nsp;
					sa = (_vala_array_free (sa, sa_length1, (GDestroyNotify) g_free), NULL);
					_g_object_unref0 (p);
					_g_free0 (k);
					_g_object_unref0 (_k_it);
					return result;
				}
				sa = (_vala_array_free (sa, sa_length1, (GDestroyNotify) g_free), NULL);
			}
			_g_free0 (nsp);
			_g_object_unref0 (p);
			_g_free0 (k);
		}
		_g_object_unref0 (_k_it);
	}
	_tmp40_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp41_ = _tmp40_;
	_tmp42_ = _tmp41_;
	_tmp43_ = _tmp42_ == NULL;
	_g_object_unref0 (_tmp42_);
	if (_tmp43_) {
		result = NULL;
		return result;
	}
	_tmp44_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp45_ = _tmp44_;
	_tmp46_ = _tmp45_;
	_tmp47_ = gxml_dom_node_lookup_namespace_uri (_tmp46_, prefix);
	_tmp48_ = _tmp47_;
	_g_object_unref0 (_tmp46_);
	result = _tmp48_;
	return result;
}

static void
gxml_element_real_remove (GXmlDomChildNode* base)
{
	GXmlElement * self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNode* _tmp2_;
	gboolean _tmp3_;
	self = (GXmlElement*) base;
	_tmp0_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ != NULL;
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		gint i = 0;
		GXmlDomNode* _tmp4_;
		GXmlDomNode* _tmp5_;
		GXmlDomNode* _tmp6_;
		GXmlDomNodeList* _tmp7_;
		GXmlDomNodeList* _tmp8_;
		GXmlDomNodeList* _tmp9_;
		gint _tmp10_;
		gboolean _tmp11_ = FALSE;
		GXmlDomNode* _tmp20_;
		GXmlDomNode* _tmp21_;
		GXmlDomNode* _tmp22_;
		GXmlDomNodeList* _tmp23_;
		GXmlDomNodeList* _tmp24_;
		GXmlDomNodeList* _tmp25_;
		gpointer _tmp26_;
		GXmlDomNode* _tmp27_;
		_tmp4_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		_tmp7_ = gxml_dom_node_get_child_nodes (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_;
		_tmp10_ = gee_list_index_of ((GeeList*) _tmp9_, (GXmlDomNode*) self);
		_g_object_unref0 (_tmp9_);
		_g_object_unref0 (_tmp6_);
		i = _tmp10_;
		if (i < 0) {
			_tmp11_ = TRUE;
		} else {
			GXmlDomNode* _tmp12_;
			GXmlDomNode* _tmp13_;
			GXmlDomNode* _tmp14_;
			GXmlDomNodeList* _tmp15_;
			GXmlDomNodeList* _tmp16_;
			GXmlDomNodeList* _tmp17_;
			gint _tmp18_;
			gint _tmp19_;
			_tmp12_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
			_tmp13_ = _tmp12_;
			_tmp14_ = _tmp13_;
			_tmp15_ = gxml_dom_node_get_child_nodes (_tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = _tmp16_;
			_tmp18_ = gxml_dom_node_list_get_length (_tmp17_);
			_tmp19_ = _tmp18_;
			_tmp11_ = i > _tmp19_;
			_g_object_unref0 (_tmp17_);
			_g_object_unref0 (_tmp14_);
		}
		if (_tmp11_) {
			g_warning ("Element.vala:257: %s", _ ("Can't locate child node to remove"));
		}
		_tmp20_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
		_tmp21_ = _tmp20_;
		_tmp22_ = _tmp21_;
		_tmp23_ = gxml_dom_node_get_child_nodes (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = _tmp24_;
		_tmp26_ = gee_list_remove_at ((GeeList*) _tmp25_, i);
		_tmp27_ = (GXmlDomNode*) _tmp26_;
		_g_object_unref0 (_tmp27_);
		_g_object_unref0 (_tmp25_);
		_g_object_unref0 (_tmp22_);
	}
}

static GXmlDomElement*
gxml_element_real_get_previous_element_sibling (GXmlDomNonDocumentTypeChildNode* base)
{
	GXmlDomElement* result;
	GXmlElement* self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNode* _tmp2_;
	gboolean _tmp3_;
	self = (GXmlElement*) base;
	_tmp0_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ != NULL;
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		gint i = 0;
		GXmlDomNode* _tmp4_;
		GXmlDomNode* _tmp5_;
		GXmlDomNode* _tmp6_;
		GXmlDomNodeList* _tmp7_;
		GXmlDomNodeList* _tmp8_;
		GXmlDomNodeList* _tmp9_;
		gint _tmp10_;
		_tmp4_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		_tmp7_ = gxml_dom_node_get_child_nodes (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_;
		_tmp10_ = gee_list_index_of ((GeeList*) _tmp9_, (GXmlDomNode*) self);
		_g_object_unref0 (_tmp9_);
		_g_object_unref0 (_tmp6_);
		i = _tmp10_;
		if (i == 0) {
			result = NULL;
			return result;
		}
		{
			gint j = 0;
			j = i;
			{
				gboolean _tmp11_ = FALSE;
				_tmp11_ = TRUE;
				while (TRUE) {
					GXmlDomNode* n = NULL;
					GXmlDomNode* _tmp13_;
					GXmlDomNode* _tmp14_;
					GXmlDomNode* _tmp15_;
					GXmlDomNodeList* _tmp16_;
					GXmlDomNodeList* _tmp17_;
					GXmlDomNodeList* _tmp18_;
					GXmlDomNode* _tmp19_;
					GXmlDomNode* _tmp20_;
					GXmlDomNode* _tmp21_;
					if (!_tmp11_) {
						gint _tmp12_;
						_tmp12_ = j;
						j = _tmp12_ - 1;
					}
					_tmp11_ = FALSE;
					if (!(j >= 1)) {
						break;
					}
					_tmp13_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
					_tmp14_ = _tmp13_;
					_tmp15_ = _tmp14_;
					_tmp16_ = gxml_dom_node_get_child_nodes (_tmp15_);
					_tmp17_ = _tmp16_;
					_tmp18_ = _tmp17_;
					_tmp19_ = gxml_dom_node_list_item (_tmp18_, j - 1);
					_tmp20_ = _tmp19_;
					_g_object_unref0 (_tmp18_);
					_g_object_unref0 (_tmp15_);
					n = _tmp20_;
					_tmp21_ = n;
					if (GXML_IS_DOM_ELEMENT (_tmp21_)) {
						GXmlDomNode* _tmp22_;
						GXmlDomElement* _tmp23_;
						_tmp22_ = n;
						_tmp23_ = _g_object_ref0 (GXML_IS_DOM_ELEMENT (_tmp22_) ? ((GXmlDomElement*) _tmp22_) : NULL);
						result = _tmp23_;
						_g_object_unref0 (n);
						return result;
					}
					_g_object_unref0 (n);
				}
			}
		}
	}
	result = NULL;
	return result;
}

static GXmlDomElement*
gxml_element_real_get_next_element_sibling (GXmlDomNonDocumentTypeChildNode* base)
{
	GXmlDomElement* result;
	GXmlElement* self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNode* _tmp2_;
	gboolean _tmp3_;
	self = (GXmlElement*) base;
	_tmp0_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ != NULL;
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		gint i = 0;
		GXmlDomNode* _tmp4_;
		GXmlDomNode* _tmp5_;
		GXmlDomNode* _tmp6_;
		GXmlDomNodeList* _tmp7_;
		GXmlDomNodeList* _tmp8_;
		GXmlDomNodeList* _tmp9_;
		gint _tmp10_;
		GXmlDomNode* _tmp11_;
		GXmlDomNode* _tmp12_;
		GXmlDomNode* _tmp13_;
		GXmlDomNodeList* _tmp14_;
		GXmlDomNodeList* _tmp15_;
		GXmlDomNodeList* _tmp16_;
		gint _tmp17_;
		gint _tmp18_;
		gboolean _tmp19_;
		_tmp4_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		_tmp7_ = gxml_dom_node_get_child_nodes (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_;
		_tmp10_ = gee_list_index_of ((GeeList*) _tmp9_, (GXmlDomNode*) self);
		_g_object_unref0 (_tmp9_);
		_g_object_unref0 (_tmp6_);
		i = _tmp10_;
		_tmp11_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
		_tmp12_ = _tmp11_;
		_tmp13_ = _tmp12_;
		_tmp14_ = gxml_dom_node_get_child_nodes (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp16_ = _tmp15_;
		_tmp17_ = gxml_dom_node_list_get_length (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = i == (_tmp18_ - 1);
		_g_object_unref0 (_tmp16_);
		_g_object_unref0 (_tmp13_);
		if (_tmp19_) {
			result = NULL;
			return result;
		}
		{
			gint j = 0;
			j = i;
			{
				gboolean _tmp20_ = FALSE;
				_tmp20_ = TRUE;
				while (TRUE) {
					GXmlDomNode* _tmp22_;
					GXmlDomNode* _tmp23_;
					GXmlDomNode* _tmp24_;
					GXmlDomNodeList* _tmp25_;
					GXmlDomNodeList* _tmp26_;
					GXmlDomNodeList* _tmp27_;
					gint _tmp28_;
					gint _tmp29_;
					gboolean _tmp30_;
					GXmlDomNode* n = NULL;
					GXmlDomNode* _tmp31_;
					GXmlDomNode* _tmp32_;
					GXmlDomNode* _tmp33_;
					GXmlDomNodeList* _tmp34_;
					GXmlDomNodeList* _tmp35_;
					GXmlDomNodeList* _tmp36_;
					GXmlDomNode* _tmp37_;
					GXmlDomNode* _tmp38_;
					GXmlDomNode* _tmp39_;
					if (!_tmp20_) {
						gint _tmp21_;
						_tmp21_ = j;
						j = _tmp21_ - 1;
					}
					_tmp20_ = FALSE;
					_tmp22_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
					_tmp23_ = _tmp22_;
					_tmp24_ = _tmp23_;
					_tmp25_ = gxml_dom_node_get_child_nodes (_tmp24_);
					_tmp26_ = _tmp25_;
					_tmp27_ = _tmp26_;
					_tmp28_ = gxml_dom_node_list_get_length (_tmp27_);
					_tmp29_ = _tmp28_;
					_tmp30_ = !(j < (_tmp29_ - 1));
					_g_object_unref0 (_tmp27_);
					_g_object_unref0 (_tmp24_);
					if (_tmp30_) {
						break;
					}
					_tmp31_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
					_tmp32_ = _tmp31_;
					_tmp33_ = _tmp32_;
					_tmp34_ = gxml_dom_node_get_child_nodes (_tmp33_);
					_tmp35_ = _tmp34_;
					_tmp36_ = _tmp35_;
					_tmp37_ = gxml_dom_node_list_item (_tmp36_, j + 1);
					_tmp38_ = _tmp37_;
					_g_object_unref0 (_tmp36_);
					_g_object_unref0 (_tmp33_);
					n = _tmp38_;
					_tmp39_ = n;
					if (GXML_IS_DOM_ELEMENT (_tmp39_)) {
						GXmlDomNode* _tmp40_;
						GXmlDomElement* _tmp41_;
						_tmp40_ = n;
						_tmp41_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp40_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement));
						result = _tmp41_;
						_g_object_unref0 (n);
						return result;
					}
					_g_object_unref0 (n);
				}
			}
		}
	}
	result = NULL;
	return result;
}

static GXmlDomHTMLCollection*
gxml_element_real_get_children (GXmlDomParentNode* base)
{
	GXmlDomHTMLCollection* result;
	GXmlElement* self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	self = (GXmlElement*) base;
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	{
		GXmlDomNodeList* _n_list = NULL;
		GXmlDomNodeList* _tmp1_;
		GXmlDomNodeList* _tmp2_;
		gint _n_size = 0;
		GXmlDomNodeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _n_index = 0;
		_tmp1_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp2_ = _tmp1_;
		_n_list = _tmp2_;
		_tmp3_ = _n_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_n_size = _tmp5_;
		_n_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			GXmlDomNode* n = NULL;
			GXmlDomNodeList* _tmp8_;
			gpointer _tmp9_;
			GXmlDomNode* _tmp10_;
			_n_index = _n_index + 1;
			_tmp6_ = _n_index;
			_tmp7_ = _n_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _n_list;
			_tmp9_ = gee_list_get ((GeeList*) _tmp8_, _n_index);
			n = (GXmlDomNode*) _tmp9_;
			_tmp10_ = n;
			if (GXML_IS_DOM_ELEMENT (_tmp10_)) {
				GXmlHTMLCollection* _tmp11_;
				GXmlDomNode* _tmp12_;
				_tmp11_ = l;
				_tmp12_ = n;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, GXML_IS_DOM_ELEMENT (_tmp12_) ? ((GXmlDomElement*) _tmp12_) : NULL);
			}
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
	result = (GXmlDomHTMLCollection*) l;
	return result;
}

static GXmlDomElement*
gxml_element_real_get_first_element_child (GXmlDomParentNode* base)
{
	GXmlDomElement* result;
	GXmlElement* self;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	GXmlDomHTMLCollection* _tmp2_;
	gpointer _tmp3_;
	GXmlDomElement* _tmp4_;
	self = (GXmlElement*) base;
	_tmp0_ = gxml_dom_parent_node_get_children ((GXmlDomParentNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_list_first ((GeeList*) _tmp2_);
	_tmp4_ = G_TYPE_CHECK_INSTANCE_CAST ((GXmlDomElement*) _tmp3_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement);
	_g_object_unref0 (_tmp2_);
	result = _tmp4_;
	return result;
}

static GXmlDomElement*
gxml_element_real_get_last_element_child (GXmlDomParentNode* base)
{
	GXmlDomElement* result;
	GXmlElement* self;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	GXmlDomHTMLCollection* _tmp2_;
	gpointer _tmp3_;
	GXmlDomElement* _tmp4_;
	self = (GXmlElement*) base;
	_tmp0_ = gxml_dom_parent_node_get_children ((GXmlDomParentNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_list_last ((GeeList*) _tmp2_);
	_tmp4_ = G_TYPE_CHECK_INSTANCE_CAST ((GXmlDomElement*) _tmp3_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement);
	_g_object_unref0 (_tmp2_);
	result = _tmp4_;
	return result;
}

static gint
gxml_element_real_get_child_element_count (GXmlDomParentNode* base)
{
	gint result;
	GXmlElement* self;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	GXmlDomHTMLCollection* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	self = (GXmlElement*) base;
	_tmp0_ = gxml_dom_parent_node_get_children ((GXmlDomParentNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}

static GXmlDomNodeList*
gxml_element_real_query_selector_all (GXmlDomParentNode* base,
                                      const gchar* selectors,
                                      GError** error)
{
	GXmlElement * self;
	GXmlCssSelectorParser* cs = NULL;
	GXmlCssSelectorParser* _tmp0_;
	GXmlCssSelectorParser* _tmp1_;
	GXmlDomNodeList* _tmp2_ = NULL;
	GXmlCssSelectorParser* _tmp3_;
	GXmlDomNodeList* _tmp4_;
	GXmlDomNodeList* _tmp5_;
	GError* _inner_error0_ = NULL;
	GXmlDomNodeList* result;
	self = (GXmlElement*) base;
	g_return_val_if_fail (selectors != NULL, NULL);
	_tmp0_ = gxml_css_selector_parser_new ();
	cs = _tmp0_;
	_tmp1_ = cs;
	gxml_css_selector_parser_parse (_tmp1_, selectors, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (cs);
		return NULL;
	}
	_tmp3_ = cs;
	_tmp4_ = gxml_css_selector_parser_query_selector_all (_tmp3_, (GXmlDomElement*) self, &_inner_error0_);
	_tmp2_ = _tmp4_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (cs);
		return NULL;
	}
	_tmp5_ = _tmp2_;
	_tmp2_ = NULL;
	result = _tmp5_;
	_g_object_unref0 (_tmp2_);
	_g_object_unref0 (cs);
	return result;
}

static gchar*
gxml_element_real_get_namespace_uri (GXmlDomElement* base)
{
	gchar* result;
	GXmlElement* self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlElement*) base;
	_tmp0_ = self->_namespace_uri;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
gxml_element_real_get_prefix (GXmlDomElement* base)
{
	gchar* result;
	GXmlElement* self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlElement*) base;
	_tmp0_ = ((GXmlNode*) self)->_prefix;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
gxml_element_real_get_local_name (GXmlDomElement* base)
{
	gchar* result;
	GXmlElement* self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlElement*) base;
	_tmp0_ = ((GXmlNode*) self)->_local_name;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
gxml_element_real_get_tag_name (GXmlDomElement* base)
{
	gchar* result;
	GXmlElement* self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlElement*) base;
	_tmp0_ = ((GXmlNode*) self)->_local_name;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static gchar*
gxml_element_real_get_id (GXmlDomElement* base)
{
	gchar* result;
	GXmlElement* self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlElement*) base;
	_tmp0_ = self->priv->_id;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
gxml_element_real_set_id (GXmlDomElement* base,
                          const gchar* value)
{
	GXmlElement* self;
	gchar* old_value;
	self = (GXmlElement*) base;
	old_value = gxml_element_real_get_id (base);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_id);
		self->priv->_id = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gxml_element_properties[GXML_ELEMENT_ID_PROPERTY]);
	}
	_g_free0 (old_value);
}

static gchar*
gxml_element_real_get_class_name (GXmlDomElement* base)
{
	gchar* result;
	GXmlElement* self;
	gchar* _tmp0_;
	self = (GXmlElement*) base;
	_tmp0_ = gxml_dom_element_get_attribute ((GXmlDomElement*) G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_ELEMENT, GXmlElement), "class");
	result = _tmp0_;
	return result;
}

static void
gxml_element_real_set_class_name (GXmlDomElement* base,
                                  const gchar* value)
{
	GXmlElement* self;
	self = (GXmlElement*) base;
	gxml_object_set_attribute (G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_OBJECT, GXmlObject), "class", value);
	g_object_notify_by_pspec ((GObject *) self, gxml_element_properties[GXML_ELEMENT_CLASS_NAME_PROPERTY]);
}

static GXmlDomTokenList*
gxml_element_real_get_class_list (GXmlDomElement* base)
{
	GXmlDomTokenList* result;
	GXmlElement* self;
	GXmlTokenList* _tmp0_;
	self = (GXmlElement*) base;
	_tmp0_ = gxml_token_list_new ((GXmlDomElement*) self, "class");
	result = (GXmlDomTokenList*) _tmp0_;
	return result;
}

/**
   * Convenient function to initialize, at construction time, a {@link GXml.Element}
   * using given local name. If {@link GXml.Element.initialize_with_namespace}
   * has been called in any base class, this method just change element node's name
   * and keeps previous namespace and prefix.
   *
   * No {@link DomDocument} is set by default, if this is a top level element in a
   * document, you can call {@link DomNode.owner_document} to set one if not set
   * already.
   *
   * Any instance properties of type {@link GXml.Element} or {@link Collection}
   * should be initialized using {@link GXml.Object.set_instance_property}
   */
void
gxml_element_initialize (GXmlElement* self,
                         const gchar* local_name)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (local_name != NULL);
	_tmp0_ = g_strdup (local_name);
	_g_free0 (((GXmlNode*) self)->_local_name);
	((GXmlNode*) self)->_local_name = _tmp0_;
}

/**
   * Convenient function to initialize, at construction time, a {@link GXml.Element}
   * using given local name and document.
   */
void
gxml_element_initialize_document (GXmlElement* self,
                                  GXmlDomDocument* doc,
                                  const gchar* local_name)
{
	GXmlDomDocument* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (doc != NULL);
	g_return_if_fail (local_name != NULL);
	_tmp0_ = _g_object_ref0 (doc);
	_g_object_unref0 (((GXmlNode*) self)->_document);
	((GXmlNode*) self)->_document = _tmp0_;
	_tmp1_ = g_strdup (local_name);
	_g_free0 (((GXmlNode*) self)->_local_name);
	((GXmlNode*) self)->_local_name = _tmp1_;
}

/**
   * Convenient function to initialize, at construction time, a {@link GXml.Element}
   * using given local name and namespace.
   */
void
gxml_element_initialize_with_namespace (GXmlElement* self,
                                        const gchar* namespace_uri,
                                        const gchar* prefix,
                                        const gchar* local_name)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (local_name != NULL);
	_tmp0_ = g_strdup (local_name);
	_g_free0 (((GXmlNode*) self)->_local_name);
	((GXmlNode*) self)->_local_name = _tmp0_;
	_tmp1_ = g_strdup (namespace_uri);
	_g_free0 (self->_namespace_uri);
	self->_namespace_uri = _tmp1_;
	_tmp2_ = g_strdup (prefix);
	_g_free0 (((GXmlNode*) self)->_prefix);
	((GXmlNode*) self)->_prefix = _tmp2_;
}

/**
   * Convenient function to initialize, at construction time, a {@link GXml.Element}
   * using given local name, document and namespace.
   */
void
gxml_element_initialize_document_with_namespace (GXmlElement* self,
                                                 GXmlDomDocument* doc,
                                                 const gchar* namespace_uri,
                                                 const gchar* prefix,
                                                 const gchar* local_name)
{
	GXmlDomDocument* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (doc != NULL);
	g_return_if_fail (local_name != NULL);
	_tmp0_ = _g_object_ref0 (doc);
	_g_object_unref0 (((GXmlNode*) self)->_document);
	((GXmlNode*) self)->_document = _tmp0_;
	_tmp1_ = g_strdup (local_name);
	_g_free0 (((GXmlNode*) self)->_local_name);
	((GXmlNode*) self)->_local_name = _tmp1_;
	_tmp2_ = g_strdup (namespace_uri);
	_g_free0 (self->_namespace_uri);
	self->_namespace_uri = _tmp2_;
	_tmp3_ = g_strdup (prefix);
	_g_free0 (((GXmlNode*) self)->_prefix);
	((GXmlNode*) self)->_prefix = _tmp3_;
}

static GXmlDomNamedNodeMap*
gxml_element_real_get_attributes (GXmlDomElement* base)
{
	GXmlDomNamedNodeMap* result;
	GXmlElement* self;
	GXmlElementAttributes* _tmp0_;
	GXmlDomNamedNodeMap* _tmp1_;
	self = (GXmlElement*) base;
	_tmp0_ = self->_attributes;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GXML_TYPE_DOM_NAMED_NODE_MAP, GXmlDomNamedNodeMap));
	result = _tmp1_;
	return result;
}

static gchar*
gxml_element_real_get_attribute (GXmlDomElement* base,
                                 const gchar* name)
{
	GXmlElement * self;
	gchar* str = NULL;
	GXmlAttr* prop = NULL;
	GXmlElementAttributes* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gpointer _tmp3_;
	GXmlDomNode* _tmp4_;
	GXmlAttr* _tmp5_;
	GXmlAttr* _tmp6_;
	GXmlAttr* _tmp7_;
	gchar* result;
	self = (GXmlElement*) base;
	g_return_val_if_fail (name != NULL, NULL);
	str = NULL;
	_tmp0_ = self->_attributes;
	_tmp1_ = g_utf8_strdown (name, (gssize) -1);
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, _tmp2_);
	_tmp4_ = (GXmlDomNode*) _tmp3_;
	_tmp5_ = GXML_IS_ATTR (_tmp4_) ? ((GXmlAttr*) _tmp4_) : NULL;
	if (_tmp5_ == NULL) {
		_g_object_unref0 (_tmp4_);
	}
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp2_);
	prop = _tmp6_;
	_tmp7_ = prop;
	if (_tmp7_ != NULL) {
		GXmlAttr* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp8_ = prop;
		_tmp9_ = gxml_dom_attr_get_value ((GXmlDomAttr*) _tmp8_);
		_tmp10_ = _tmp9_;
		_g_free0 (str);
		str = _tmp10_;
	}
	result = str;
	_g_object_unref0 (prop);
	return result;
}

static gchar*
gxml_element_real_get_attribute_ns (GXmlDomElement* base,
                                    const gchar* namespace_uri,
                                    const gchar* local_name)
{
	GXmlElement * self;
	GError* _inner_error0_ = NULL;
	gchar* result;
	self = (GXmlElement*) base;
	g_return_val_if_fail (local_name != NULL, NULL);
	{
		GXmlDomNode* _tmp0_ = NULL;
		GXmlElementAttributes* _tmp1_;
		GXmlDomNode* _tmp2_;
		GXmlAttr* a = NULL;
		GXmlAttr* _tmp3_;
		GXmlAttr* _tmp4_;
		_tmp1_ = self->_attributes;
		_tmp2_ = gxml_dom_named_node_map_get_named_item_ns ((GXmlDomNamedNodeMap*) _tmp1_, namespace_uri, local_name, &_inner_error0_);
		_tmp0_ = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = _g_object_ref0 (GXML_IS_ATTR (_tmp0_) ? ((GXmlAttr*) _tmp0_) : NULL);
		a = _tmp3_;
		_tmp4_ = a;
		if (_tmp4_ != NULL) {
			GXmlAttr* _tmp5_;
			gchar* _tmp6_;
			gchar* _tmp7_;
			_tmp5_ = a;
			_tmp6_ = gxml_dom_attr_get_value ((GXmlDomAttr*) _tmp5_);
			_tmp7_ = _tmp6_;
			result = _tmp7_;
			_g_object_unref0 (a);
			_g_object_unref0 (_tmp0_);
			return result;
		}
		result = NULL;
		_g_object_unref0 (a);
		_g_object_unref0 (_tmp0_);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp8_;
		const gchar* _tmp9_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp8_ = e;
		_tmp9_ = _tmp8_->message;
		g_debug (_ ("Error getting attribute with namespace: %s"), _tmp9_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	result = NULL;
	return result;
}

static void
gxml_element_real_set_attribute (GXmlDomElement* base,
                                 const gchar* name,
                                 const gchar* value,
                                 GError** error)
{
	GXmlElement * self;
	GXmlAttr* a = NULL;
	GXmlAttr* _tmp0_;
	GXmlDomNamedNodeMap* _tmp1_;
	GXmlDomNamedNodeMap* _tmp2_;
	GXmlDomNamedNodeMap* _tmp3_;
	GXmlDomNode* _tmp4_;
	GXmlDomNode* _tmp5_;
	GError* _inner_error0_ = NULL;
	self = (GXmlElement*) base;
	g_return_if_fail (name != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = gxml_attr_new ((GXmlDomElement*) self, name, value);
	a = _tmp0_;
	_tmp1_ = gxml_dom_element_get_attributes ((GXmlDomElement*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = gxml_dom_named_node_map_set_named_item (_tmp3_, (GXmlDomNode*) a, &_inner_error0_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp5_);
	_g_object_unref0 (_tmp3_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (a);
		return;
	}
	_g_object_unref0 (a);
}

static void
gxml_element_real_set_attribute_ns (GXmlDomElement* base,
                                    const gchar* namespace_uri,
                                    const gchar* name,
                                    const gchar* value,
                                    GError** error)
{
	GXmlElement * self;
	gchar* p = NULL;
	gchar* _tmp0_;
	gchar* n = NULL;
	gchar* _tmp1_;
	gboolean _tmp15_ = FALSE;
	gboolean _tmp18_ = FALSE;
	const gchar* _tmp19_;
	gboolean _tmp22_ = FALSE;
	const gchar* _tmp23_;
	gboolean _tmp26_ = FALSE;
	const gchar* _tmp27_;
	gboolean _tmp30_ = FALSE;
	const gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	gboolean _tmp34_;
	gboolean _tmp35_ = FALSE;
	gboolean _tmp36_ = FALSE;
	const gchar* _tmp37_;
	gboolean _tmp39_ = FALSE;
	const gchar* _tmp40_;
	gchar* _tmp41_;
	gchar* _tmp42_;
	gboolean _tmp43_;
	gboolean _tmp44_ = FALSE;
	gboolean _tmp45_ = FALSE;
	const gchar* _tmp46_;
	gboolean _tmp48_ = FALSE;
	const gchar* _tmp49_;
	gchar* _tmp50_;
	gchar* _tmp51_;
	gboolean _tmp52_;
	gboolean _tmp53_ = FALSE;
	gboolean _tmp54_ = FALSE;
	const gchar* _tmp55_;
	gboolean _tmp57_ = FALSE;
	const gchar* _tmp58_;
	gchar* _tmp59_;
	gchar* _tmp60_;
	gboolean _tmp61_;
	gboolean _tmp62_ = FALSE;
	gboolean _tmp63_ = FALSE;
	const gchar* _tmp64_;
	gboolean _tmp66_ = FALSE;
	const gchar* _tmp67_;
	gchar* _tmp68_;
	gchar* _tmp69_;
	gboolean _tmp70_;
	gboolean _tmp71_ = FALSE;
	gboolean _tmp72_ = FALSE;
	const gchar* _tmp73_;
	gchar* _tmp74_;
	gchar* _tmp75_;
	gboolean _tmp76_;
	gboolean _tmp78_ = FALSE;
	const gchar* _tmp79_;
	gchar* _tmp80_;
	gchar* _tmp81_;
	gboolean _tmp82_;
	gboolean _tmp83_ = FALSE;
	gboolean _tmp84_ = FALSE;
	const gchar* _tmp85_;
	gchar* _tmp86_;
	gchar* _tmp87_;
	gboolean _tmp88_;
	gboolean _tmp90_ = FALSE;
	const gchar* _tmp91_;
	gchar* _tmp92_;
	gchar* _tmp93_;
	gboolean _tmp94_;
	gboolean _tmp95_ = FALSE;
	gboolean _tmp96_ = FALSE;
	const gchar* _tmp97_;
	gchar* _tmp98_;
	gchar* _tmp99_;
	gboolean _tmp100_;
	GXmlAttr* a = NULL;
	const gchar* _tmp102_;
	const gchar* _tmp103_;
	GXmlAttr* _tmp104_;
	GError* _inner_error0_ = NULL;
	self = (GXmlElement*) base;
	g_return_if_fail (name != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = g_strdup ("");
	p = _tmp0_;
	_tmp1_ = g_strdup (name);
	n = _tmp1_;
	if (string_contains (name, ":")) {
		gchar** s = NULL;
		gchar** _tmp2_;
		gchar** _tmp3_;
		gint s_length1;
		gint _s_size_;
		gchar** _tmp4_;
		gint _tmp4__length1;
		gchar** _tmp6_;
		gint _tmp6__length1;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gchar** _tmp9_;
		gint _tmp9__length1;
		const gchar* _tmp10_;
		gchar* _tmp11_;
		const gchar* _tmp12_;
		_tmp3_ = _tmp2_ = g_strsplit (name, ":", 0);
		s = _tmp3_;
		s_length1 = _vala_array_length (_tmp2_);
		_s_size_ = s_length1;
		_tmp4_ = s;
		_tmp4__length1 = s_length1;
		if (_tmp4__length1 != 2) {
			GError* _tmp5_;
			_tmp5_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid attribute name. Just one prefix is allowed"));
			_inner_error0_ = _tmp5_;
			g_propagate_error (error, _inner_error0_);
			s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (n);
			_g_free0 (p);
			return;
		}
		_tmp6_ = s;
		_tmp6__length1 = s_length1;
		_tmp7_ = _tmp6_[0];
		_tmp8_ = g_strdup (_tmp7_);
		_g_free0 (p);
		p = _tmp8_;
		_tmp9_ = s;
		_tmp9__length1 = s_length1;
		_tmp10_ = _tmp9_[1];
		_tmp11_ = g_strdup (_tmp10_);
		_g_free0 (n);
		n = _tmp11_;
		_tmp12_ = n;
		if (string_contains (_tmp12_, ":")) {
			const gchar* _tmp13_;
			GError* _tmp14_;
			_tmp13_ = n;
			_tmp14_ = g_error_new (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid attribute name. Invalid use of colon: %s"), _tmp13_);
			_inner_error0_ = _tmp14_;
			g_propagate_error (error, _inner_error0_);
			s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (n);
			_g_free0 (p);
			return;
		}
		s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
	}
	if (namespace_uri == NULL) {
		const gchar* _tmp16_;
		_tmp16_ = p;
		_tmp15_ = g_strcmp0 (_tmp16_, "") == 0;
	} else {
		_tmp15_ = FALSE;
	}
	if (_tmp15_) {
		GError* _tmp17_;
		_tmp17_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace. If prefix is null, namespace URI should not be null"));
		_inner_error0_ = _tmp17_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp19_ = p;
	if (g_strcmp0 (_tmp19_, "") == 0) {
		const gchar* _tmp20_;
		_tmp20_ = n;
		_tmp18_ = g_strcmp0 (_tmp20_, "xmlns") != 0;
	} else {
		_tmp18_ = FALSE;
	}
	if (_tmp18_) {
		GError* _tmp21_;
		_tmp21_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace definition. No prefixed attributes should use 'xmlns" \
"' as name"));
		_inner_error0_ = _tmp21_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp23_ = p;
	if (g_strcmp0 (_tmp23_, "xmlns") == 0) {
		const gchar* _tmp24_;
		_tmp24_ = n;
		_tmp22_ = g_strcmp0 (_tmp24_, "xml") == 0;
	} else {
		_tmp22_ = FALSE;
	}
	if (_tmp22_) {
		GError* _tmp25_;
		_tmp25_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("'xml' namespace should not be defined"));
		_inner_error0_ = _tmp25_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp27_ = p;
	if (g_strcmp0 (_tmp27_, "xmlns") == 0) {
		const gchar* _tmp28_;
		_tmp28_ = n;
		_tmp26_ = g_strcmp0 (_tmp28_, "xmlns") == 0;
	} else {
		_tmp26_ = FALSE;
	}
	if (_tmp26_) {
		GError* _tmp29_;
		_tmp29_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("'xmlns' namespace should not be defined"));
		_inner_error0_ = _tmp29_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp31_ = p;
	_tmp32_ = g_utf8_strdown (_tmp31_, (gssize) -1);
	_tmp33_ = _tmp32_;
	_tmp34_ = g_strcmp0 (_tmp33_, "xml") == 0;
	_g_free0 (_tmp33_);
	if (_tmp34_) {
		_tmp30_ = namespace_uri == NULL;
	} else {
		_tmp30_ = FALSE;
	}
	if (_tmp30_) {
		namespace_uri = "http://www.w3.org/XML/1998/namespace/";
	}
	_tmp37_ = p;
	if (g_strcmp0 (_tmp37_, "xml") == 0) {
		_tmp36_ = g_strcmp0 (namespace_uri, "http://www.w3.org/XML/1998/namespace/") != 0;
	} else {
		_tmp36_ = FALSE;
	}
	if (_tmp36_) {
		_tmp35_ = g_strcmp0 (namespace_uri, "http://www.w3.org/XML/1998/namespace") != 0;
	} else {
		_tmp35_ = FALSE;
	}
	if (_tmp35_) {
		GError* _tmp38_;
		_tmp38_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace. If prefix is 'xml', namespace URI should be http://" \
"www.w3.org/XML/1998/namespace"));
		_inner_error0_ = _tmp38_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp40_ = p;
	_tmp41_ = g_utf8_strdown (_tmp40_, (gssize) -1);
	_tmp42_ = _tmp41_;
	_tmp43_ = g_strcmp0 (_tmp42_, "xmlns") == 0;
	_g_free0 (_tmp42_);
	if (_tmp43_) {
		_tmp39_ = namespace_uri == NULL;
	} else {
		_tmp39_ = FALSE;
	}
	if (_tmp39_) {
		namespace_uri = "http://www.w3.org/2000/xmlns/";
	}
	_tmp46_ = n;
	if (g_strcmp0 (_tmp46_, "xmlns") == 0) {
		_tmp45_ = g_strcmp0 (namespace_uri, "http://www.w3.org/2000/xmlns/") != 0;
	} else {
		_tmp45_ = FALSE;
	}
	if (_tmp45_) {
		_tmp44_ = g_strcmp0 (namespace_uri, "http://www.w3.org/2000/xmlns") != 0;
	} else {
		_tmp44_ = FALSE;
	}
	if (_tmp44_) {
		GError* _tmp47_;
		_tmp47_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace definition. If attribute's prefix is 'xmlns', namesp" \
"ace URI should be http://www.w3.org/2000/xmlns"));
		_inner_error0_ = _tmp47_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp49_ = p;
	_tmp50_ = g_utf8_strdown (_tmp49_, (gssize) -1);
	_tmp51_ = _tmp50_;
	_tmp52_ = g_strcmp0 (_tmp51_, "html") == 0;
	_g_free0 (_tmp51_);
	if (_tmp52_) {
		_tmp48_ = namespace_uri == NULL;
	} else {
		_tmp48_ = FALSE;
	}
	if (_tmp48_) {
		namespace_uri = "http://www.w3.org/1999/xhtml/";
	}
	_tmp55_ = p;
	if (g_strcmp0 (_tmp55_, "html") == 0) {
		_tmp54_ = g_strcmp0 (namespace_uri, "http://www.w3.org/1999/xhtml/") != 0;
	} else {
		_tmp54_ = FALSE;
	}
	if (_tmp54_) {
		_tmp53_ = g_strcmp0 (namespace_uri, "http://www.w3.org/1999/xhtml") != 0;
	} else {
		_tmp53_ = FALSE;
	}
	if (_tmp53_) {
		GError* _tmp56_;
		_tmp56_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace. If attribute's prefix is 'html', namespace URI shou" \
"ld be http://www.w3.org/1999/xhtml"));
		_inner_error0_ = _tmp56_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp58_ = p;
	_tmp59_ = g_utf8_strdown (_tmp58_, (gssize) -1);
	_tmp60_ = _tmp59_;
	_tmp61_ = g_strcmp0 (_tmp60_, "xsi") == 0;
	_g_free0 (_tmp60_);
	if (_tmp61_) {
		_tmp57_ = namespace_uri == NULL;
	} else {
		_tmp57_ = FALSE;
	}
	if (_tmp57_) {
		namespace_uri = "http://www.w3.org/2001/XMLSchema-instance/";
	}
	_tmp64_ = p;
	if (g_strcmp0 (_tmp64_, "xsi") == 0) {
		_tmp63_ = g_strcmp0 (namespace_uri, "http://www.w3.org/2001/XMLSchema-instance/") != 0;
	} else {
		_tmp63_ = FALSE;
	}
	if (_tmp63_) {
		_tmp62_ = g_strcmp0 (namespace_uri, "http://www.w3.org/2001/XMLSchema-instance") != 0;
	} else {
		_tmp62_ = FALSE;
	}
	if (_tmp62_) {
		GError* _tmp65_;
		_tmp65_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace. If attribute's prefix is 'xsi', namespace URI shoul" \
"d be http://www.w3.org/2001/XMLSchema-instance"));
		_inner_error0_ = _tmp65_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp67_ = p;
	_tmp68_ = g_utf8_strdown (_tmp67_, (gssize) -1);
	_tmp69_ = _tmp68_;
	_tmp70_ = g_strcmp0 (_tmp69_, "mathml") == 0;
	_g_free0 (_tmp69_);
	if (_tmp70_) {
		_tmp66_ = namespace_uri == NULL;
	} else {
		_tmp66_ = FALSE;
	}
	if (_tmp66_) {
		namespace_uri = "http://www.w3.org/1998/Math/MathML/";
	}
	_tmp73_ = p;
	_tmp74_ = g_utf8_strdown (_tmp73_, (gssize) -1);
	_tmp75_ = _tmp74_;
	_tmp76_ = g_strcmp0 (_tmp75_, "mathml") == 0;
	_g_free0 (_tmp75_);
	if (_tmp76_) {
		_tmp72_ = g_strcmp0 (namespace_uri, "http://www.w3.org/1998/Math/MathML/") != 0;
	} else {
		_tmp72_ = FALSE;
	}
	if (_tmp72_) {
		_tmp71_ = g_strcmp0 (namespace_uri, "http://www.w3.org/1998/Math/MathML") != 0;
	} else {
		_tmp71_ = FALSE;
	}
	if (_tmp71_) {
		GError* _tmp77_;
		_tmp77_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace. If attribute's prefix is 'MathML', namespace URI sh" \
"ould be http://www.w3.org/1998/Math/MathML"));
		_inner_error0_ = _tmp77_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp79_ = p;
	_tmp80_ = g_utf8_strdown (_tmp79_, (gssize) -1);
	_tmp81_ = _tmp80_;
	_tmp82_ = g_strcmp0 (_tmp81_, "svg") == 0;
	_g_free0 (_tmp81_);
	if (_tmp82_) {
		_tmp78_ = namespace_uri == NULL;
	} else {
		_tmp78_ = FALSE;
	}
	if (_tmp78_) {
		namespace_uri = "http://www.w3.org/2000/svg/";
	}
	_tmp85_ = p;
	_tmp86_ = g_utf8_strdown (_tmp85_, (gssize) -1);
	_tmp87_ = _tmp86_;
	_tmp88_ = g_strcmp0 (_tmp87_, "svg") == 0;
	_g_free0 (_tmp87_);
	if (_tmp88_) {
		_tmp84_ = g_strcmp0 (namespace_uri, "http://www.w3.org/2000/svg/") != 0;
	} else {
		_tmp84_ = FALSE;
	}
	if (_tmp84_) {
		_tmp83_ = g_strcmp0 (namespace_uri, "http://www.w3.org/2000/svg") != 0;
	} else {
		_tmp83_ = FALSE;
	}
	if (_tmp83_) {
		GError* _tmp89_;
		_tmp89_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace. If attribute's prefix is 'svg', namespace URI shoul" \
"d be http://www.w3.org/2000/svg"));
		_inner_error0_ = _tmp89_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp91_ = p;
	_tmp92_ = g_utf8_strdown (_tmp91_, (gssize) -1);
	_tmp93_ = _tmp92_;
	_tmp94_ = g_strcmp0 (_tmp93_, "xlink") == 0;
	_g_free0 (_tmp93_);
	if (_tmp94_) {
		_tmp90_ = namespace_uri == NULL;
	} else {
		_tmp90_ = FALSE;
	}
	if (_tmp90_) {
		namespace_uri = "http://www.w3.org/1999/xlink/";
	}
	_tmp97_ = p;
	_tmp98_ = g_utf8_strdown (_tmp97_, (gssize) -1);
	_tmp99_ = _tmp98_;
	_tmp100_ = g_strcmp0 (_tmp99_, "xlink") == 0;
	_g_free0 (_tmp99_);
	if (_tmp100_) {
		_tmp96_ = g_strcmp0 (namespace_uri, "http://www.w3.org/1999/xlink/") != 0;
	} else {
		_tmp96_ = FALSE;
	}
	if (_tmp96_) {
		_tmp95_ = g_strcmp0 (namespace_uri, "http://www.w3.org/1999/xlink") != 0;
	} else {
		_tmp95_ = FALSE;
	}
	if (_tmp95_) {
		GError* _tmp101_;
		_tmp101_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace. If attribute's prefix is 'xlink', namespace URI sho" \
"uld be http://www.w3.org/1999/xlink"));
		_inner_error0_ = _tmp101_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_tmp102_ = p;
	_tmp103_ = n;
	_tmp104_ = gxml_attr_new_namespace ((GXmlDomElement*) self, namespace_uri, _tmp102_, _tmp103_, value);
	a = _tmp104_;
	{
		GXmlElementAttributes* _tmp105_;
		GXmlAttr* _tmp106_;
		GXmlDomNode* _tmp107_;
		GXmlDomNode* _tmp108_;
		_tmp105_ = self->_attributes;
		_tmp106_ = a;
		_tmp107_ = gxml_dom_named_node_map_set_named_item_ns ((GXmlDomNamedNodeMap*) _tmp105_, (GXmlDomNode*) _tmp106_, &_inner_error0_);
		_tmp108_ = _tmp107_;
		_g_object_unref0 (_tmp108_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp109_;
		const gchar* _tmp110_;
		gchar* _tmp111_;
		gchar* _tmp112_;
		GError* _tmp113_;
		GError* _tmp114_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp109_ = e;
		_tmp110_ = _tmp109_->message;
		_tmp111_ = g_strconcat (_ ("Setting namespaced property error: "), _tmp110_, NULL);
		_tmp112_ = _tmp111_;
		_tmp113_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _tmp112_);
		_tmp114_ = _tmp113_;
		_g_free0 (_tmp112_);
		_inner_error0_ = _tmp114_;
		_g_error_free0 (e);
		goto __finally0;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (a);
		_g_free0 (n);
		_g_free0 (p);
		return;
	}
	_g_object_unref0 (a);
	_g_free0 (n);
	_g_free0 (p);
}

static void
gxml_element_real_remove_attribute (GXmlDomElement* base,
                                    const gchar* name)
{
	GXmlElement * self;
	GError* _inner_error0_ = NULL;
	self = (GXmlElement*) base;
	g_return_if_fail (name != NULL);
	{
		GXmlDomNamedNodeMap* _tmp0_;
		GXmlDomNamedNodeMap* _tmp1_;
		GXmlDomNamedNodeMap* _tmp2_;
		GXmlDomNode* _tmp3_;
		GXmlDomNode* _tmp4_;
		_tmp0_ = gxml_dom_element_get_attributes ((GXmlDomElement*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gxml_dom_named_node_map_remove_named_item (_tmp2_, name, &_inner_error0_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp4_);
		_g_object_unref0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		_tmp7_ = g_strconcat (_ ("Removing attribute Error: "), _tmp6_, NULL);
		_tmp8_ = _tmp7_;
		g_warning ("Element.vala:769: %s", _tmp8_);
		_g_free0 (_tmp8_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
gxml_element_real_remove_attribute_ns (GXmlDomElement* base,
                                       const gchar* namespace_uri,
                                       const gchar* local_name)
{
	GXmlElement * self;
	GError* _inner_error0_ = NULL;
	self = (GXmlElement*) base;
	g_return_if_fail (local_name != NULL);
	{
		GXmlDomNamedNodeMap* _tmp0_;
		GXmlDomNamedNodeMap* _tmp1_;
		GXmlDomNamedNodeMap* _tmp2_;
		GXmlDomNode* _tmp3_;
		GXmlDomNode* _tmp4_;
		_tmp0_ = gxml_dom_element_get_attributes ((GXmlDomElement*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gxml_dom_named_node_map_remove_named_item_ns (_tmp2_, namespace_uri, local_name, &_inner_error0_);
		_tmp4_ = _tmp3_;
		_g_object_unref0 (_tmp4_);
		_g_object_unref0 (_tmp2_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp5_;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp5_ = e;
		_tmp6_ = _tmp5_->message;
		_tmp7_ = g_strconcat (_ ("Removing namespaced attribute Error: "), _tmp6_, NULL);
		_tmp8_ = _tmp7_;
		g_warning ("Element.vala:774: %s", _tmp8_);
		_g_free0 (_tmp8_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static gboolean
gxml_element_real_has_attribute (GXmlDomElement* base,
                                 const gchar* name)
{
	GXmlElement * self;
	GXmlElementAttributes* _tmp0_;
	gboolean result;
	self = (GXmlElement*) base;
	g_return_val_if_fail (name != NULL, FALSE);
	_tmp0_ = self->_attributes;
	result = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, name);
	return result;
}

static gboolean
gxml_element_real_has_attribute_ns (GXmlDomElement* base,
                                    const gchar* namespace_uri,
                                    const gchar* local_name)
{
	GXmlElement * self;
	gchar* nsp = NULL;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gchar* name = NULL;
	gchar* _tmp4_;
	const gchar* _tmp5_;
	GXmlDomNamedNodeMap* _tmp10_;
	GXmlDomNamedNodeMap* _tmp11_;
	GXmlDomNamedNodeMap* _tmp12_;
	const gchar* _tmp13_;
	gboolean _tmp14_;
	gboolean result;
	self = (GXmlElement*) base;
	g_return_val_if_fail (local_name != NULL, FALSE);
	nsp = NULL;
	if (g_strcmp0 (namespace_uri, "http://www.w3.org/2000/xmlns/") == 0) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = g_strcmp0 (namespace_uri, "http://www.w3.org/2000/xmlns") == 0;
	}
	if (_tmp1_) {
		_tmp0_ = g_strcmp0 (local_name, "xmlns") != 0;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup ("xmlns");
		_g_free0 (nsp);
		nsp = _tmp2_;
	} else {
		gchar* _tmp3_;
		_tmp3_ = gxml_element_lookup_prefix (self, namespace_uri);
		_g_free0 (nsp);
		nsp = _tmp3_;
	}
	_tmp4_ = g_strdup (local_name);
	name = _tmp4_;
	_tmp5_ = nsp;
	if (_tmp5_ != NULL) {
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		_tmp6_ = nsp;
		_tmp7_ = g_strconcat (_tmp6_, ":", NULL);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_strconcat (_tmp8_, local_name, NULL);
		_g_free0 (name);
		name = _tmp9_;
		_g_free0 (_tmp8_);
	}
	_tmp10_ = gxml_dom_element_get_attributes ((GXmlDomElement*) self);
	_tmp11_ = _tmp10_;
	_tmp12_ = _tmp11_;
	_tmp13_ = name;
	_tmp14_ = gee_map_has_key ((GeeMap*) _tmp12_, _tmp13_);
	_g_object_unref0 (_tmp12_);
	result = _tmp14_;
	_g_free0 (name);
	_g_free0 (nsp);
	return result;
}

static GXmlDomHTMLCollection*
gxml_element_real_get_elements_by_tag_name (GXmlDomElement* base,
                                            const gchar* local_name)
{
	GXmlElement * self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* result;
	self = (GXmlElement*) base;
	g_return_val_if_fail (local_name != NULL, NULL);
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	{
		GXmlDomNodeList* _n_list = NULL;
		GXmlDomNodeList* _tmp1_;
		GXmlDomNodeList* _tmp2_;
		gint _n_size = 0;
		GXmlDomNodeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _n_index = 0;
		_tmp1_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp2_ = _tmp1_;
		_n_list = _tmp2_;
		_tmp3_ = _n_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_n_size = _tmp5_;
		_n_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			GXmlDomNode* n = NULL;
			GXmlDomNodeList* _tmp8_;
			gpointer _tmp9_;
			GXmlDomNode* _tmp10_;
			GXmlDomNode* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gboolean _tmp15_;
			GXmlHTMLCollection* _tmp18_;
			GXmlDomNode* _tmp19_;
			GXmlDomHTMLCollection* _tmp20_;
			GXmlDomHTMLCollection* _tmp21_;
			_n_index = _n_index + 1;
			_tmp6_ = _n_index;
			_tmp7_ = _n_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _n_list;
			_tmp9_ = gee_list_get ((GeeList*) _tmp8_, _n_index);
			n = (GXmlDomNode*) _tmp9_;
			_tmp10_ = n;
			if (!GXML_IS_DOM_ELEMENT (_tmp10_)) {
				_g_object_unref0 (n);
				continue;
			}
			_tmp11_ = n;
			_tmp12_ = gxml_dom_node_get_node_name (_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = _tmp13_;
			_tmp15_ = g_strcmp0 (_tmp14_, local_name) == 0;
			_g_free0 (_tmp14_);
			if (_tmp15_) {
				GXmlHTMLCollection* _tmp16_;
				GXmlDomNode* _tmp17_;
				_tmp16_ = l;
				_tmp17_ = n;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement));
			}
			_tmp18_ = l;
			_tmp19_ = n;
			_tmp20_ = gxml_dom_element_get_elements_by_tag_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp19_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement), local_name);
			_tmp21_ = _tmp20_;
			gee_array_list_add_all ((GeeArrayList*) _tmp18_, (GeeCollection*) _tmp21_);
			_g_object_unref0 (_tmp21_);
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
	result = (GXmlDomHTMLCollection*) l;
	return result;
}

static GXmlDomHTMLCollection*
gxml_element_real_get_elements_by_tag_name_ns (GXmlDomElement* base,
                                               const gchar* namespace,
                                               const gchar* local_name)
{
	GXmlElement * self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* result;
	self = (GXmlElement*) base;
	g_return_val_if_fail (local_name != NULL, NULL);
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	{
		GXmlDomNodeList* _n_list = NULL;
		GXmlDomNodeList* _tmp1_;
		GXmlDomNodeList* _tmp2_;
		gint _n_size = 0;
		GXmlDomNodeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _n_index = 0;
		_tmp1_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp2_ = _tmp1_;
		_n_list = _tmp2_;
		_tmp3_ = _n_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_n_size = _tmp5_;
		_n_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			GXmlDomNode* n = NULL;
			GXmlDomNodeList* _tmp8_;
			gpointer _tmp9_;
			GXmlDomNode* _tmp10_;
			gboolean _tmp11_ = FALSE;
			GXmlDomNode* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gchar* _tmp15_;
			gboolean _tmp16_;
			GXmlHTMLCollection* _tmp23_;
			GXmlDomNode* _tmp24_;
			GXmlDomHTMLCollection* _tmp25_;
			GXmlDomHTMLCollection* _tmp26_;
			_n_index = _n_index + 1;
			_tmp6_ = _n_index;
			_tmp7_ = _n_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _n_list;
			_tmp9_ = gee_list_get ((GeeList*) _tmp8_, _n_index);
			n = (GXmlDomNode*) _tmp9_;
			_tmp10_ = n;
			if (!GXML_IS_DOM_ELEMENT (_tmp10_)) {
				_g_object_unref0 (n);
				continue;
			}
			_tmp12_ = n;
			_tmp13_ = gxml_dom_node_get_node_name (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp15_ = _tmp14_;
			_tmp16_ = g_strcmp0 (_tmp15_, local_name) == 0;
			_g_free0 (_tmp15_);
			if (_tmp16_) {
				GXmlDomNode* _tmp17_;
				gchar* _tmp18_;
				gchar* _tmp19_;
				gchar* _tmp20_;
				_tmp17_ = n;
				_tmp18_ = gxml_dom_element_get_namespace_uri (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement));
				_tmp19_ = _tmp18_;
				_tmp20_ = _tmp19_;
				_tmp11_ = g_strcmp0 (_tmp20_, namespace) == 0;
				_g_free0 (_tmp20_);
			} else {
				_tmp11_ = FALSE;
			}
			if (_tmp11_) {
				GXmlHTMLCollection* _tmp21_;
				GXmlDomNode* _tmp22_;
				_tmp21_ = l;
				_tmp22_ = n;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp21_, G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement));
			}
			_tmp23_ = l;
			_tmp24_ = n;
			_tmp25_ = gxml_dom_element_get_elements_by_tag_name_ns (G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement), namespace, local_name);
			_tmp26_ = _tmp25_;
			gee_array_list_add_all ((GeeArrayList*) _tmp23_, (GeeCollection*) _tmp26_);
			_g_object_unref0 (_tmp26_);
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
	result = (GXmlDomHTMLCollection*) l;
	return result;
}

static void
_vala_array_add1 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add2 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static GXmlDomHTMLCollection*
gxml_element_real_get_elements_by_class_name (GXmlDomElement* base,
                                              const gchar* class_names)
{
	GXmlElement * self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	gchar** cs = NULL;
	gchar** _tmp1_;
	gint cs_length1;
	gint _cs_size_;
	GXmlDomHTMLCollection* result;
	self = (GXmlElement*) base;
	g_return_val_if_fail (class_names != NULL, NULL);
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	if (g_strcmp0 (class_names, "") == 0) {
		result = (GXmlDomHTMLCollection*) l;
		return result;
	}
	_tmp1_ = g_new0 (gchar*, 0 + 1);
	cs = _tmp1_;
	cs_length1 = 0;
	_cs_size_ = cs_length1;
	if (string_contains (class_names, " ")) {
		gchar** _tmp2_;
		gchar** _tmp3_;
		_tmp3_ = _tmp2_ = g_strsplit (class_names, " ", 0);
		cs = (_vala_array_free (cs, cs_length1, (GDestroyNotify) g_free), NULL);
		cs = _tmp3_;
		cs_length1 = _vala_array_length (_tmp2_);
		_cs_size_ = cs_length1;
	} else {
		gchar* _tmp4_;
		_tmp4_ = g_strdup (class_names);
		_vala_array_add1 (&cs, &cs_length1, &_cs_size_, _tmp4_);
	}
	{
		GXmlDomNodeList* _n_list = NULL;
		GXmlDomNodeList* _tmp5_;
		GXmlDomNodeList* _tmp6_;
		gint _n_size = 0;
		GXmlDomNodeList* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gint _n_index = 0;
		_tmp5_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp6_ = _tmp5_;
		_n_list = _tmp6_;
		_tmp7_ = _n_list;
		_tmp8_ = gee_collection_get_size ((GeeCollection*) _tmp7_);
		_tmp9_ = _tmp8_;
		_n_size = _tmp9_;
		_n_index = -1;
		while (TRUE) {
			gint _tmp10_;
			gint _tmp11_;
			GXmlDomNode* n = NULL;
			GXmlDomNodeList* _tmp12_;
			gpointer _tmp13_;
			GXmlDomNode* _tmp14_;
			gchar* cls = NULL;
			GXmlDomNode* _tmp15_;
			gchar* _tmp16_;
			const gchar* _tmp17_;
			GXmlHTMLCollection* _tmp40_;
			GXmlDomNode* _tmp41_;
			GXmlDomHTMLCollection* _tmp42_;
			GXmlDomHTMLCollection* _tmp43_;
			_n_index = _n_index + 1;
			_tmp10_ = _n_index;
			_tmp11_ = _n_size;
			if (!(_tmp10_ < _tmp11_)) {
				break;
			}
			_tmp12_ = _n_list;
			_tmp13_ = gee_list_get ((GeeList*) _tmp12_, _n_index);
			n = (GXmlDomNode*) _tmp13_;
			_tmp14_ = n;
			if (!GXML_IS_DOM_ELEMENT (_tmp14_)) {
				_g_object_unref0 (n);
				continue;
			}
			_tmp15_ = n;
			_tmp16_ = gxml_dom_element_get_attribute (G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement), "class");
			cls = _tmp16_;
			_tmp17_ = cls;
			if (_tmp17_ != NULL) {
				gchar** ncls = NULL;
				gchar** _tmp18_;
				gint ncls_length1;
				gint _ncls_size_;
				const gchar* _tmp19_;
				gint found = 0;
				gchar** _tmp25_;
				gint _tmp25__length1;
				gchar** _tmp32_;
				gint _tmp32__length1;
				_tmp18_ = g_new0 (gchar*, 0 + 1);
				ncls = _tmp18_;
				ncls_length1 = 0;
				_ncls_size_ = ncls_length1;
				_tmp19_ = cls;
				if (string_contains (_tmp19_, " ")) {
					const gchar* _tmp20_;
					gchar** _tmp21_;
					gchar** _tmp22_;
					_tmp20_ = cls;
					_tmp22_ = _tmp21_ = g_strsplit (_tmp20_, " ", 0);
					ncls = (_vala_array_free (ncls, ncls_length1, (GDestroyNotify) g_free), NULL);
					ncls = _tmp22_;
					ncls_length1 = _vala_array_length (_tmp21_);
					_ncls_size_ = ncls_length1;
				} else {
					const gchar* _tmp23_;
					gchar* _tmp24_;
					_tmp23_ = cls;
					_tmp24_ = g_strdup (_tmp23_);
					_vala_array_add2 (&ncls, &ncls_length1, &_ncls_size_, _tmp24_);
				}
				found = 0;
				_tmp25_ = cs;
				_tmp25__length1 = cs_length1;
				{
					gchar** cl_collection = NULL;
					gint cl_collection_length1 = 0;
					gint _cl_collection_size_ = 0;
					gint cl_it = 0;
					cl_collection = _tmp25_;
					cl_collection_length1 = _tmp25__length1;
					for (cl_it = 0; cl_it < cl_collection_length1; cl_it = cl_it + 1) {
						gchar* _tmp26_;
						gchar* cl = NULL;
						_tmp26_ = g_strdup (cl_collection[cl_it]);
						cl = _tmp26_;
						{
							gchar** _tmp27_;
							gint _tmp27__length1;
							_tmp27_ = ncls;
							_tmp27__length1 = ncls_length1;
							{
								gchar** ncl_collection = NULL;
								gint ncl_collection_length1 = 0;
								gint _ncl_collection_size_ = 0;
								gint ncl_it = 0;
								ncl_collection = _tmp27_;
								ncl_collection_length1 = _tmp27__length1;
								for (ncl_it = 0; ncl_it < ncl_collection_length1; ncl_it = ncl_it + 1) {
									gchar* _tmp28_;
									gchar* ncl = NULL;
									_tmp28_ = g_strdup (ncl_collection[ncl_it]);
									ncl = _tmp28_;
									{
										const gchar* _tmp29_;
										const gchar* _tmp30_;
										_tmp29_ = cl;
										_tmp30_ = ncl;
										if (g_strcmp0 (_tmp29_, _tmp30_) == 0) {
											gint _tmp31_;
											_tmp31_ = found;
											found = _tmp31_ + 1;
										}
										_g_free0 (ncl);
									}
								}
							}
							_g_free0 (cl);
						}
					}
				}
				_tmp32_ = cs;
				_tmp32__length1 = cs_length1;
				if (found == _tmp32__length1) {
					GXmlHTMLCollection* _tmp33_;
					gint _tmp34_;
					gint _tmp35_;
					_tmp33_ = l;
					_tmp34_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp33_);
					_tmp35_ = _tmp34_;
					if (_tmp35_ == 0) {
						GXmlHTMLCollection* _tmp36_;
						GXmlDomNode* _tmp37_;
						_tmp36_ = l;
						_tmp37_ = n;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp36_, G_TYPE_CHECK_INSTANCE_CAST (_tmp37_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement));
					} else {
						GXmlHTMLCollection* _tmp38_;
						GXmlDomNode* _tmp39_;
						_tmp38_ = l;
						_tmp39_ = n;
						gee_abstract_list_insert ((GeeAbstractList*) _tmp38_, 0, G_TYPE_CHECK_INSTANCE_CAST (_tmp39_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement));
					}
				}
				ncls = (_vala_array_free (ncls, ncls_length1, (GDestroyNotify) g_free), NULL);
			}
			_tmp40_ = l;
			_tmp41_ = n;
			_tmp42_ = gxml_dom_element_get_elements_by_class_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp41_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement), class_names);
			_tmp43_ = _tmp42_;
			gee_array_list_add_all ((GeeArrayList*) _tmp40_, (GeeCollection*) _tmp43_);
			_g_object_unref0 (_tmp43_);
			_g_free0 (cls);
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
	result = (GXmlDomHTMLCollection*) l;
	cs = (_vala_array_free (cs, cs_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

gboolean
gxml_element_get_parse_children (GXmlElement* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_parse_children;
	return result;
}

void
gxml_element_set_parse_children (GXmlElement* self,
                                 gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = gxml_element_get_parse_children (self);
	if (old_value != value) {
		self->priv->_parse_children = value;
		g_object_notify_by_pspec ((GObject *) self, gxml_element_properties[GXML_ELEMENT_PARSE_CHILDREN_PROPERTY]);
	}
}

const gchar*
gxml_element_get_unparsed (GXmlElement* self)
{
	const gchar* result;
	GMemoryOutputStream* _tmp0_;
	const gchar* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_read_buffer;
	if (_tmp0_ != NULL) {
		GMemoryOutputStream* _tmp1_;
		void* _tmp2_;
		void* _tmp3_;
		_tmp1_ = self->priv->_read_buffer;
		_tmp2_ = g_memory_output_stream_get_data (_tmp1_);
		_tmp3_ = _tmp2_;
		result = (const gchar*) _tmp3_;
		return result;
	}
	_tmp4_ = self->priv->_unparsed;
	result = _tmp4_;
	return result;
}

void
gxml_element_set_unparsed (GXmlElement* self,
                           const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_unparsed);
	self->priv->_unparsed = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, gxml_element_properties[GXML_ELEMENT_UNPARSED_PROPERTY]);
}

/**
   * Parse all children, adding them to current node, stored in {@link unparsed}.
   * Once it finish, sets {@link unparsed} to null.
   */
void
gxml_element_read_unparsed (GXmlElement* self,
                            GError** error)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = gxml_element_get_unparsed (self);
	_tmp1_ = _tmp0_;
	if (_tmp1_ != NULL) {
		GXmlXParser* parser = NULL;
		GXmlXParser* _tmp2_;
		GXmlXParser* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp2_ = gxml_xparser_new ((GXmlDomNode*) self);
		parser = _tmp2_;
		_tmp3_ = parser;
		_tmp4_ = gxml_element_get_unparsed (self);
		_tmp5_ = _tmp4_;
		gxml_parser_read_child_nodes_string ((GXmlParser*) _tmp3_, _tmp5_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (parser);
			return;
		}
		gxml_element_set_unparsed (self, NULL);
		_g_object_unref0 (parser);
	}
}

GMemoryOutputStream*
gxml_element_get_read_buffer (GXmlElement* self)
{
	GMemoryOutputStream* result;
	GMemoryOutputStream* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_read_buffer;
	result = _tmp0_;
	return result;
}

void
gxml_element_set_read_buffer (GXmlElement* self,
                              GMemoryOutputStream* value)
{
	GMemoryOutputStream* old_value;
	g_return_if_fail (self != NULL);
	old_value = gxml_element_get_read_buffer (self);
	if (old_value != value) {
		GMemoryOutputStream* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_read_buffer);
		self->priv->_read_buffer = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, gxml_element_properties[GXML_ELEMENT_READ_BUFFER_PROPERTY]);
	}
}

/**
   * Synchronically parse {@link read_buffer}
   */
void
gxml_element_parse_buffer (GXmlElement* self,
                           GError** error)
{
	GMemoryOutputStream* _tmp11_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	{
		GXmlDomNodeList* _n_list = NULL;
		GXmlDomNodeList* _tmp0_;
		GXmlDomNodeList* _tmp1_;
		gint _n_size = 0;
		GXmlDomNodeList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _n_index = 0;
		_tmp0_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp1_ = _tmp0_;
		_n_list = _tmp1_;
		_tmp2_ = _n_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_n_size = _tmp4_;
		_n_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			GXmlDomNode* n = NULL;
			GXmlDomNodeList* _tmp7_;
			gpointer _tmp8_;
			GXmlDomNode* _tmp9_;
			_n_index = _n_index + 1;
			_tmp5_ = _n_index;
			_tmp6_ = _n_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _n_list;
			_tmp8_ = gee_list_get ((GeeList*) _tmp7_, _n_index);
			n = (GXmlDomNode*) _tmp8_;
			_tmp9_ = n;
			if (GXML_IS_ELEMENT (_tmp9_)) {
				GXmlDomNode* _tmp10_;
				_tmp10_ = n;
				gxml_element_parse_buffer (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, GXML_TYPE_ELEMENT, GXmlElement), &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					g_propagate_error (error, _inner_error0_);
					_g_object_unref0 (n);
					_g_object_unref0 (_n_list);
					return;
				}
			}
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
	_tmp11_ = self->priv->_read_buffer;
	if (_tmp11_ != NULL) {
		GMemoryOutputStream* _tmp12_;
		void* _tmp13_;
		void* _tmp14_;
		_tmp12_ = self->priv->_read_buffer;
		_tmp13_ = g_memory_output_stream_get_data (_tmp12_);
		_tmp14_ = _tmp13_;
		gxml_dom_element_read_from_string ((GXmlDomElement*) self, (const gchar*) _tmp14_, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			return;
		}
		gxml_element_set_read_buffer (self, NULL);
	}
}

/**
   * Monitor multi-threading parsing
   */
guint
gxml_element_parse_pending (GXmlElement* self)
{
	GThreadPool* _tmp0_;
	GThreadPool* _tmp1_;
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	_tmp0_ = self->priv->pool;
	if (_tmp0_ == NULL) {
		result = (guint) 0;
		return result;
	}
	_tmp1_ = self->priv->pool;
	result = g_thread_pool_unprocessed (_tmp1_);
	return result;
}

static void
gxml_element_parse_buffer_async_data_free (gpointer _data)
{
	GxmlElementParseBufferAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlElementParseBufferAsyncData, _data_);
}

void
gxml_element_parse_buffer_async (GXmlElement* self,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_)
{
	GxmlElementParseBufferAsyncData* _data_;
	GXmlElement* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (GxmlElementParseBufferAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_element_parse_buffer_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	gxml_element_parse_buffer_async_co (_data_);
}

void
gxml_element_parse_buffer_finish (GXmlElement* self,
                                  GAsyncResult* _res_,
                                  GError** error)
{
	GxmlElementParseBufferAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Asynchronically parse {@link read_buffer}
   */
static void
__lambda5_ (GXmlElement* self,
            GXmlElement* e)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (e != NULL);
	{
		GMemoryOutputStream* _tmp0_;
		_tmp0_ = e->priv->_read_buffer;
		if (_tmp0_ != NULL) {
			GMemoryOutputStream* _tmp1_;
			void* _tmp2_;
			void* _tmp3_;
			_tmp1_ = e->priv->_read_buffer;
			_tmp2_ = g_memory_output_stream_get_data (_tmp1_);
			_tmp3_ = _tmp2_;
			gxml_dom_element_read_from_string ((GXmlDomElement*) e, (const gchar*) _tmp3_, NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			gxml_element_set_read_buffer (e, NULL);
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		GError* _tmp4_;
		const gchar* _tmp5_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp4_ = err;
		_tmp5_ = _tmp4_->message;
		g_warning (_ ("Error parsing child's buffer: %s"), _tmp5_);
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_object_unref0 (e);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_g_object_unref0 (e);
}

static void
___lambda5__gfunc (gpointer data,
                   gpointer self)
{
	__lambda5_ ((GXmlElement*) self, (GXmlElement*) data);
}

static gboolean
gxml_element_parse_buffer_async_co (GxmlElementParseBufferAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->_read_buffer;
	if (_data_->_tmp0_ == NULL) {
		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;
	}
	_data_->nth = g_get_num_processors ();
	if (_data_->nth > ((guint) 1)) {
		_data_->nth = (guint) (_data_->nth - 1);
	}
	_data_->_tmp2_ = g_thread_pool_new (___lambda5__gfunc, _data_->self, (gint) _data_->nth, FALSE, &_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_->_tmp3_ = _data_->_tmp1_;
	_data_->_tmp1_ = NULL;
	_g_thread_pool_free0 (_data_->self->priv->pool);
	_data_->self->priv->pool = _data_->_tmp3_;
	{
		_data_->_tmp4_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) _data_->self);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_n_list = _data_->_tmp5_;
		_data_->_tmp6_ = _data_->_n_list;
		_data_->_tmp7_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp6_);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_n_size = _data_->_tmp8_;
		_data_->_n_index = -1;
		while (TRUE) {
			_data_->_n_index = _data_->_n_index + 1;
			_data_->_tmp9_ = _data_->_n_index;
			_data_->_tmp10_ = _data_->_n_size;
			if (!(_data_->_tmp9_ < _data_->_tmp10_)) {
				break;
			}
			_data_->_tmp11_ = _data_->_n_list;
			_data_->_tmp12_ = gee_list_get ((GeeList*) _data_->_tmp11_, _data_->_n_index);
			_data_->n = (GXmlDomNode*) _data_->_tmp12_;
			_data_->_tmp13_ = _data_->n;
			if (GXML_IS_ELEMENT (_data_->_tmp13_)) {
				_data_->_tmp14_ = _data_->self->priv->pool;
				_data_->_tmp15_ = _data_->n;
				_data_->_tmp16_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp15_, GXML_TYPE_ELEMENT, GXmlElement));
				g_thread_pool_push (_data_->_tmp14_, _data_->_tmp16_, &_data_->_inner_error0_);
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->n);
					_g_object_unref0 (_data_->_n_list);
					_g_thread_pool_free0 (_data_->_tmp1_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
			}
			_g_object_unref0 (_data_->n);
		}
		_g_object_unref0 (_data_->_n_list);
	}
	_data_->_tmp17_ = _data_->self->priv->_read_buffer;
	_data_->_tmp18_ = g_memory_output_stream_get_data (_data_->_tmp17_);
	_data_->_tmp19_ = _data_->_tmp18_;
	gxml_dom_element_read_from_string ((GXmlDomElement*) _data_->self, (const gchar*) _data_->_tmp19_, NULL, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_thread_pool_free0 (_data_->_tmp1_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	gxml_element_set_read_buffer (_data_->self, NULL);
	_g_thread_pool_free0 (_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;
}

GXmlElement*
gxml_element_construct (GType object_type)
{
	GXmlElement * self = NULL;
	self = (GXmlElement*) gxml_node_construct (object_type);
	return self;
}

GXmlElement*
gxml_element_new (void)
{
	return gxml_element_construct (GXML_TYPE_ELEMENT);
}

static inline gpointer
gxml_element_attributes_get_instance_private (GXmlElementAttributes* self)
{
	return G_STRUCT_MEMBER_P (self, GXmlElementAttributes_private_offset);
}

static gint
gxml_element_attributes_real_get_length (GXmlDomNamedNodeMap* base)
{
	gint result;
	GXmlElementAttributes* self;
	gint _tmp0_;
	gint _tmp1_;
	self = (GXmlElementAttributes*) base;
	_tmp0_ = gee_abstract_map_get_size ((GeeAbstractMap*) self);
	_tmp1_ = _tmp0_;
	result = _tmp1_;
	return result;
}

static GXmlDomNode*
gxml_element_attributes_real_item (GXmlDomNamedNodeMap* base,
                                   gint index)
{
	GXmlElementAttributes * self;
	gboolean _tmp0_ = FALSE;
	glong i = 0L;
	GXmlDomNode* result;
	self = (GXmlElementAttributes*) base;
	if (index < 0) {
		_tmp0_ = TRUE;
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = gee_abstract_map_get_size ((GeeAbstractMap*) self);
		_tmp2_ = _tmp1_;
		_tmp0_ = index >= _tmp2_;
	}
	if (_tmp0_) {
		result = NULL;
		return result;
	}
	i = (glong) -1;
	{
		GeeIterator* _e_it = NULL;
		GeeTreeMap* _tmp3_;
		GeeSortedSet* _tmp4_;
		GeeSortedSet* _tmp5_;
		GeeSortedSet* _tmp6_;
		GeeIterator* _tmp7_;
		GeeIterator* _tmp8_;
		_tmp3_ = self->priv->order;
		_tmp4_ = gee_abstract_sorted_map_get_ascending_entries ((GeeAbstractSortedMap*) _tmp3_);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		_tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
		_tmp8_ = _tmp7_;
		_g_object_unref0 (_tmp6_);
		_e_it = _tmp8_;
		while (TRUE) {
			GeeIterator* _tmp9_;
			GeeMapEntry* e = NULL;
			GeeIterator* _tmp10_;
			gpointer _tmp11_;
			glong _tmp12_;
			_tmp9_ = _e_it;
			if (!gee_iterator_next (_tmp9_)) {
				break;
			}
			_tmp10_ = _e_it;
			_tmp11_ = gee_iterator_get (_tmp10_);
			e = (GeeMapEntry*) _tmp11_;
			_tmp12_ = i;
			i = _tmp12_ + 1;
			if (i == ((glong) index)) {
				GXmlDomNode* ret = NULL;
				GeeMapEntry* _tmp13_;
				gconstpointer _tmp14_;
				gconstpointer _tmp15_;
				gpointer _tmp16_;
				_tmp13_ = e;
				_tmp14_ = gee_map_entry_get_value (_tmp13_);
				_tmp15_ = _tmp14_;
				_tmp16_ = gee_abstract_map_get ((GeeAbstractMap*) self, (const gchar*) _tmp15_);
				ret = (GXmlDomNode*) _tmp16_;
				result = ret;
				_g_object_unref0 (e);
				_g_object_unref0 (_e_it);
				return result;
			}
			_g_object_unref0 (e);
		}
		_g_object_unref0 (_e_it);
	}
	result = NULL;
	return result;
}

GXmlElementAttributes*
gxml_element_attributes_construct (GType object_type,
                                   GXmlElement* element)
{
	GXmlElementAttributes * self = NULL;
	GXmlElement* _tmp0_;
	g_return_val_if_fail (element != NULL, NULL);
	self = (GXmlElementAttributes*) gee_hash_map_construct (object_type, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GXML_TYPE_DOM_NODE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_tmp0_ = _g_object_ref0 (element);
	_g_object_unref0 (self->_element);
	self->_element = _tmp0_;
	return self;
}

GXmlElementAttributes*
gxml_element_attributes_new (GXmlElement* element)
{
	return gxml_element_attributes_construct (GXML_ELEMENT_TYPE_ATTRIBUTES, element);
}

static GXmlDomNode*
gxml_element_attributes_real_get_named_item (GXmlDomNamedNodeMap* base,
                                             const gchar* name)
{
	GXmlElementAttributes * self;
	gchar* ov = NULL;
	GXmlElement* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* p = NULL;
	gchar* _tmp6_;
	gchar* ns = NULL;
	gchar* n = NULL;
	gchar* _tmp7_;
	GXmlAttr* prop = NULL;
	const gchar* _tmp29_;
	gpointer _tmp30_;
	GXmlDomNode* _tmp31_;
	GXmlAttr* _tmp32_;
	gchar* val = NULL;
	GXmlAttr* _tmp33_;
	const gchar* _tmp37_;
	GXmlDomNode* attr = NULL;
	gboolean _tmp38_ = FALSE;
	const gchar* _tmp39_;
	GXmlDomNode* result;
	self = (GXmlElementAttributes*) base;
	g_return_val_if_fail (name != NULL, NULL);
	if (g_strcmp0 (name, "") == 0) {
		result = NULL;
		return result;
	}
	_tmp0_ = self->_element;
	_tmp1_ = gxml_object_get_attribute (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, GXML_TYPE_OBJECT, GXmlObject), name);
	ov = _tmp1_;
	_tmp2_ = ov;
	if (_tmp2_ != NULL) {
		GXmlElement* _tmp3_;
		const gchar* _tmp4_;
		GXmlAttr* _tmp5_;
		_tmp3_ = self->_element;
		_tmp4_ = ov;
		_tmp5_ = gxml_attr_new ((GXmlDomElement*) _tmp3_, name, _tmp4_);
		result = (GXmlDomNode*) _tmp5_;
		_g_free0 (ov);
		return result;
	}
	_tmp6_ = g_strdup ("");
	p = _tmp6_;
	ns = NULL;
	_tmp7_ = g_utf8_strdown (name, (gssize) -1);
	n = _tmp7_;
	if (string_contains (name, ":")) {
		gchar** s = NULL;
		gchar** _tmp8_;
		gchar** _tmp9_;
		gint s_length1;
		gint _s_size_;
		gchar** _tmp10_;
		gint _tmp10__length1;
		gchar** _tmp11_;
		gint _tmp11__length1;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		gchar** _tmp14_;
		gint _tmp14__length1;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		const gchar* _tmp17_;
		const gchar* _tmp19_;
		gboolean _tmp23_ = FALSE;
		const gchar* _tmp24_;
		_tmp9_ = _tmp8_ = g_strsplit (name, ":", 0);
		s = _tmp9_;
		s_length1 = _vala_array_length (_tmp8_);
		_s_size_ = s_length1;
		_tmp10_ = s;
		_tmp10__length1 = s_length1;
		if (_tmp10__length1 > 2) {
			result = NULL;
			s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (n);
			_g_free0 (ns);
			_g_free0 (p);
			_g_free0 (ov);
			return result;
		}
		_tmp11_ = s;
		_tmp11__length1 = s_length1;
		_tmp12_ = _tmp11_[0];
		_tmp13_ = g_strdup (_tmp12_);
		_g_free0 (p);
		p = _tmp13_;
		_tmp14_ = s;
		_tmp14__length1 = s_length1;
		_tmp15_ = _tmp14_[1];
		_tmp16_ = g_utf8_strdown (_tmp15_, (gssize) -1);
		_g_free0 (n);
		n = _tmp16_;
		_tmp17_ = p;
		if (g_strcmp0 (_tmp17_, "xml") == 0) {
			gchar* _tmp18_;
			_tmp18_ = g_strdup ("http://www.w3.org/2000/xmlns/");
			_g_free0 (ns);
			ns = _tmp18_;
		}
		_tmp19_ = p;
		if (g_strcmp0 (_tmp19_, "xmlns") == 0) {
			GXmlElement* _tmp20_;
			const gchar* _tmp21_;
			gchar* _tmp22_;
			_tmp20_ = self->_element;
			_tmp21_ = n;
			_tmp22_ = gxml_element_lookup_namespace_uri (_tmp20_, _tmp21_);
			_g_free0 (ns);
			ns = _tmp22_;
		}
		_tmp24_ = p;
		if (g_strcmp0 (_tmp24_, "xmlns") != 0) {
			const gchar* _tmp25_;
			_tmp25_ = p;
			_tmp23_ = g_strcmp0 (_tmp25_, "xml") != 0;
		} else {
			_tmp23_ = FALSE;
		}
		if (_tmp23_) {
			GXmlElement* _tmp26_;
			const gchar* _tmp27_;
			gchar* _tmp28_;
			_tmp26_ = self->_element;
			_tmp27_ = p;
			_tmp28_ = gxml_element_lookup_namespace_uri (_tmp26_, _tmp27_);
			_g_free0 (ns);
			ns = _tmp28_;
		}
		s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp29_ = n;
	_tmp30_ = gee_abstract_map_get ((GeeAbstractMap*) self, _tmp29_);
	_tmp31_ = (GXmlDomNode*) _tmp30_;
	_tmp32_ = GXML_IS_ATTR (_tmp31_) ? ((GXmlAttr*) _tmp31_) : NULL;
	if (_tmp32_ == NULL) {
		_g_object_unref0 (_tmp31_);
	}
	prop = _tmp32_;
	val = NULL;
	_tmp33_ = prop;
	if (_tmp33_ != NULL) {
		GXmlAttr* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
		_tmp34_ = prop;
		_tmp35_ = gxml_dom_attr_get_value ((GXmlDomAttr*) _tmp34_);
		_tmp36_ = _tmp35_;
		_g_free0 (val);
		val = _tmp36_;
	}
	_tmp37_ = val;
	if (_tmp37_ == NULL) {
		result = NULL;
		_g_free0 (val);
		_g_object_unref0 (prop);
		_g_free0 (n);
		_g_free0 (ns);
		_g_free0 (p);
		_g_free0 (ov);
		return result;
	}
	attr = NULL;
	_tmp39_ = p;
	if (_tmp39_ == NULL) {
		_tmp38_ = TRUE;
	} else {
		const gchar* _tmp40_;
		_tmp40_ = p;
		_tmp38_ = g_strcmp0 (_tmp40_, "") == 0;
	}
	if (_tmp38_) {
		GXmlElement* _tmp41_;
		const gchar* _tmp42_;
		const gchar* _tmp43_;
		GXmlAttr* _tmp44_;
		_tmp41_ = self->_element;
		_tmp42_ = n;
		_tmp43_ = val;
		_tmp44_ = gxml_attr_new ((GXmlDomElement*) _tmp41_, _tmp42_, _tmp43_);
		_g_object_unref0 (attr);
		attr = (GXmlDomNode*) _tmp44_;
	} else {
		GXmlElement* _tmp45_;
		const gchar* _tmp46_;
		const gchar* _tmp47_;
		const gchar* _tmp48_;
		const gchar* _tmp49_;
		GXmlAttr* _tmp50_;
		_tmp45_ = self->_element;
		_tmp46_ = ns;
		_tmp47_ = p;
		_tmp48_ = n;
		_tmp49_ = val;
		_tmp50_ = gxml_attr_new_namespace ((GXmlDomElement*) _tmp45_, _tmp46_, _tmp47_, _tmp48_, _tmp49_);
		_g_object_unref0 (attr);
		attr = (GXmlDomNode*) _tmp50_;
	}
	result = attr;
	_g_free0 (val);
	_g_object_unref0 (prop);
	_g_free0 (n);
	_g_free0 (ns);
	_g_free0 (p);
	_g_free0 (ov);
	return result;
}

/**
     * Takes given {@link DomNode} as a {@link GXml.Attr} and use its name and
     * value to set a property in {@link DomElement} ignoring node's prefix and
     * namespace
     */
static GXmlDomNode*
gxml_element_attributes_real_set_named_item (GXmlDomNamedNodeMap* base,
                                             GXmlDomNode* node,
                                             GError** error)
{
	GXmlElementAttributes * self;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	GXmlAttr* attr = NULL;
	GParamSpec* pprop = NULL;
	GXmlElement* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	GParamSpec* _tmp18_;
	GParamSpec* _tmp19_;
	GParamSpec* _tmp20_;
	GXmlAttr* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	gchar* _tmp46_;
	GXmlAttr* _tmp47_;
	GeeTreeMap* _tmp48_;
	gint _tmp49_;
	gint _tmp50_;
	gchar* _tmp51_;
	gchar* _tmp52_;
	gchar* _tmp53_;
	gchar* _tmp54_;
	gchar* _tmp55_;
	GError* _inner_error0_ = NULL;
	GXmlDomNode* result;
	self = (GXmlElementAttributes*) base;
	g_return_val_if_fail (node != NULL, NULL);
	_tmp1_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = string_contains (_tmp3_, ":");
	_g_free0 (_tmp3_);
	if (_tmp4_) {
		_tmp0_ = TRUE;
	} else {
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp5_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp0_ = g_strcmp0 (_tmp7_, "") == 0;
		_g_free0 (_tmp7_);
	}
	if (_tmp0_) {
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		GError* _tmp11_;
		GError* _tmp12_;
		_tmp8_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp9_ = _tmp8_;
		_tmp10_ = _tmp9_;
		_tmp11_ = g_error_new (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_CHARACTER_ERROR, _ ("Invalid attribute name: %s"), _tmp10_);
		_tmp12_ = _tmp11_;
		_g_free0 (_tmp10_);
		_inner_error0_ = _tmp12_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (!GXML_IS_ATTR (node)) {
		GError* _tmp13_;
		_tmp13_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Invalid node type. GXml.Attr was expected"));
		_inner_error0_ = _tmp13_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	attr = NULL;
	_tmp14_ = self->_element;
	_tmp15_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp16_ = _tmp15_;
	_tmp17_ = _tmp16_;
	_tmp18_ = gxml_object_find_property_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, GXML_TYPE_OBJECT, GXmlObject), _tmp17_);
	_tmp19_ = _tmp18_;
	_g_free0 (_tmp17_);
	pprop = _tmp19_;
	_tmp20_ = pprop;
	if (_tmp20_ != NULL) {
		GXmlElement* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		gchar* _tmp26_;
		gchar* _tmp27_;
		GXmlElement* _tmp28_;
		gchar* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		GXmlAttr* _tmp32_;
		_tmp21_ = self->_element;
		_tmp22_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp23_ = _tmp22_;
		_tmp24_ = _tmp23_;
		_tmp25_ = gxml_dom_node_get_node_value (node);
		_tmp26_ = _tmp25_;
		_tmp27_ = _tmp26_;
		gxml_object_set_attribute (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, GXML_TYPE_OBJECT, GXmlObject), _tmp24_, _tmp27_);
		_g_free0 (_tmp27_);
		_g_free0 (_tmp24_);
		_tmp28_ = self->_element;
		_tmp29_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp30_ = _tmp29_;
		_tmp31_ = _tmp30_;
		_tmp32_ = gxml_attr_new_reference ((GXmlDomElement*) _tmp28_, _tmp31_);
		_g_object_unref0 (attr);
		attr = _tmp32_;
		_g_free0 (_tmp31_);
	} else {
		GXmlElement* _tmp33_;
		gchar* _tmp34_;
		gchar* _tmp35_;
		gchar* _tmp36_;
		gchar* _tmp37_;
		gchar* _tmp38_;
		gchar* _tmp39_;
		GXmlAttr* _tmp40_;
		_tmp33_ = self->_element;
		_tmp34_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp35_ = _tmp34_;
		_tmp36_ = _tmp35_;
		_tmp37_ = gxml_dom_node_get_node_value (node);
		_tmp38_ = _tmp37_;
		_tmp39_ = _tmp38_;
		_tmp40_ = gxml_attr_new ((GXmlDomElement*) _tmp33_, _tmp36_, _tmp39_);
		_g_object_unref0 (attr);
		attr = _tmp40_;
		_g_free0 (_tmp39_);
		_g_free0 (_tmp36_);
	}
	_tmp41_ = attr;
	_tmp42_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) _tmp41_);
	_tmp43_ = _tmp42_;
	_tmp44_ = _tmp43_;
	_tmp45_ = g_utf8_strdown (_tmp44_, (gssize) -1);
	_tmp46_ = _tmp45_;
	_tmp47_ = attr;
	gee_abstract_map_set ((GeeAbstractMap*) self, _tmp46_, (GXmlDomNode*) _tmp47_);
	_g_free0 (_tmp46_);
	_g_free0 (_tmp44_);
	_tmp48_ = self->priv->order;
	_tmp49_ = gee_abstract_map_get_size ((GeeAbstractMap*) self);
	_tmp50_ = _tmp49_;
	_tmp51_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp52_ = _tmp51_;
	_tmp53_ = _tmp52_;
	_tmp54_ = g_utf8_strdown (_tmp53_, (gssize) -1);
	_tmp55_ = _tmp54_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp48_, (gpointer) ((gintptr) (_tmp50_ - 1)), _tmp55_);
	_g_free0 (_tmp55_);
	_g_free0 (_tmp53_);
	result = (GXmlDomNode*) attr;
	_g_param_spec_unref0 (pprop);
	return result;
}

static GXmlDomNode*
gxml_element_attributes_real_remove_named_item (GXmlDomNamedNodeMap* base,
                                                const gchar* name,
                                                GError** error)
{
	GXmlElementAttributes * self;
	gchar* val = NULL;
	GXmlAttr* prop = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gpointer _tmp2_;
	GXmlDomNode* _tmp3_;
	GXmlAttr* _tmp4_;
	GXmlAttr* _tmp5_;
	GXmlAttr* _tmp6_;
	GXmlAttr* _tmp16_;
	GXmlDomNode* _tmp17_;
	GXmlDomNode* result;
	self = (GXmlElementAttributes*) base;
	g_return_val_if_fail (name != NULL, NULL);
	if (string_contains (name, ":")) {
		result = NULL;
		return result;
	}
	val = NULL;
	_tmp0_ = g_utf8_strdown (name, (gssize) -1);
	_tmp1_ = _tmp0_;
	_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) self, _tmp1_);
	_tmp3_ = (GXmlDomNode*) _tmp2_;
	_tmp4_ = GXML_IS_ATTR (_tmp3_) ? ((GXmlAttr*) _tmp3_) : NULL;
	if (_tmp4_ == NULL) {
		_g_object_unref0 (_tmp3_);
	}
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp1_);
	prop = _tmp5_;
	_tmp6_ = prop;
	if (_tmp6_ != NULL) {
		GXmlAttr* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		GXmlAttr* _tmp10_;
		glong i = 0L;
		gchar* _tmp11_;
		gchar* _tmp12_;
		_tmp7_ = prop;
		_tmp8_ = gxml_dom_attr_get_value ((GXmlDomAttr*) _tmp7_);
		_tmp9_ = _tmp8_;
		_g_free0 (val);
		val = _tmp9_;
		_tmp10_ = prop;
		gxml_dom_attr_set_value ((GXmlDomAttr*) _tmp10_, NULL);
		i = gxml_element_attributes_index_of (self, name);
		_tmp11_ = g_utf8_strdown (name, (gssize) -1);
		_tmp12_ = _tmp11_;
		gee_abstract_map_unset ((GeeAbstractMap*) self, _tmp12_, NULL);
		_g_free0 (_tmp12_);
		if (i < ((glong) 0)) {
			gchar* _tmp13_;
			gchar* _tmp14_;
			_tmp13_ = g_strdup_printf (_ ("No index found for attribute %s"), name);
			_tmp14_ = _tmp13_;
			g_warning ("Element.vala:512: %s", _tmp14_);
			_g_free0 (_tmp14_);
		} else {
			GeeTreeMap* _tmp15_;
			_tmp15_ = self->priv->order;
			gee_abstract_map_unset ((GeeAbstractMap*) _tmp15_, (gpointer) ((gintptr) i), NULL);
		}
	}
	_tmp16_ = prop;
	_tmp17_ = _g_object_ref0 (GXML_IS_DOM_NODE (_tmp16_) ? ((GXmlDomNode*) _tmp16_) : NULL);
	result = _tmp17_;
	_g_object_unref0 (prop);
	_g_free0 (val);
	return result;
}

static GXmlDomNode*
gxml_element_attributes_real_remove_named_item_ns (GXmlDomNamedNodeMap* base,
                                                   const gchar* namespace_uri,
                                                   const gchar* local_name,
                                                   GError** error)
{
	GXmlElementAttributes * self;
	gchar* nsp = NULL;
	GXmlElement* _tmp0_;
	gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	GXmlAttr* v = NULL;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gpointer _tmp12_;
	GXmlDomNode* _tmp13_;
	GXmlAttr* _tmp14_;
	GXmlAttr* _tmp15_;
	GXmlAttr* _tmp16_;
	gchar* k = NULL;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	GXmlAttr* _tmp24_;
	const gchar* _tmp25_;
	glong i = 0L;
	const gchar* _tmp26_;
	GXmlAttr* _tmp31_;
	GXmlDomNode* _tmp32_;
	GXmlDomNode* result;
	self = (GXmlElementAttributes*) base;
	g_return_val_if_fail (namespace_uri != NULL, NULL);
	g_return_val_if_fail (local_name != NULL, NULL);
	if (string_contains (local_name, ":")) {
		result = NULL;
		return result;
	}
	_tmp0_ = self->_element;
	_tmp1_ = gxml_element_lookup_prefix (_tmp0_, namespace_uri);
	nsp = _tmp1_;
	_tmp3_ = nsp;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = nsp;
		_tmp2_ = g_strcmp0 (_tmp4_, "") == 0;
	}
	if (_tmp2_) {
		result = NULL;
		_g_free0 (nsp);
		return result;
	}
	_tmp5_ = nsp;
	_tmp6_ = g_strconcat (_tmp5_, ":", NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strconcat (_tmp7_, local_name, NULL);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_utf8_strdown (_tmp9_, (gssize) -1);
	_tmp11_ = _tmp10_;
	_tmp12_ = gee_abstract_map_get ((GeeAbstractMap*) self, _tmp11_);
	_tmp13_ = (GXmlDomNode*) _tmp12_;
	_tmp14_ = GXML_IS_ATTR (_tmp13_) ? ((GXmlAttr*) _tmp13_) : NULL;
	if (_tmp14_ == NULL) {
		_g_object_unref0 (_tmp13_);
	}
	_tmp15_ = _tmp14_;
	_g_free0 (_tmp11_);
	_g_free0 (_tmp9_);
	_g_free0 (_tmp7_);
	v = _tmp15_;
	_tmp16_ = v;
	if (_tmp16_ == NULL) {
		result = NULL;
		_g_object_unref0 (v);
		_g_free0 (nsp);
		return result;
	}
	_tmp17_ = nsp;
	_tmp18_ = g_strconcat (_tmp17_, ":", NULL);
	_tmp19_ = _tmp18_;
	_tmp20_ = g_strconcat (_tmp19_, local_name, NULL);
	_tmp21_ = _tmp20_;
	_tmp22_ = g_utf8_strdown (_tmp21_, (gssize) -1);
	_tmp23_ = _tmp22_;
	_g_free0 (_tmp21_);
	_g_free0 (_tmp19_);
	k = _tmp23_;
	_tmp24_ = v;
	gxml_dom_attr_set_value ((GXmlDomAttr*) _tmp24_, NULL);
	_tmp25_ = k;
	gee_abstract_map_unset ((GeeAbstractMap*) self, _tmp25_, NULL);
	_tmp26_ = k;
	i = gxml_element_attributes_index_of (self, _tmp26_);
	if (i < ((glong) 0)) {
		const gchar* _tmp27_;
		gchar* _tmp28_;
		gchar* _tmp29_;
		_tmp27_ = k;
		_tmp28_ = g_strdup_printf (_ ("No index found for attribute %s"), _tmp27_);
		_tmp29_ = _tmp28_;
		g_warning ("Element.vala:531: %s", _tmp29_);
		_g_free0 (_tmp29_);
	} else {
		GeeTreeMap* _tmp30_;
		_tmp30_ = self->priv->order;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp30_, (gpointer) ((gintptr) i), NULL);
	}
	_tmp31_ = v;
	_tmp32_ = _g_object_ref0 (GXML_IS_DOM_NODE (_tmp31_) ? ((GXmlDomNode*) _tmp31_) : NULL);
	result = _tmp32_;
	_g_free0 (k);
	_g_object_unref0 (v);
	_g_free0 (nsp);
	return result;
}

static GXmlDomNode*
gxml_element_attributes_real_get_named_item_ns (GXmlDomNamedNodeMap* base,
                                                const gchar* namespace_uri,
                                                const gchar* local_name,
                                                GError** error)
{
	GXmlElementAttributes * self;
	gchar* nsp = NULL;
	GXmlElement* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* k = NULL;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	GXmlDomNode* v = NULL;
	const gchar* _tmp12_;
	gpointer _tmp13_;
	GError* _inner_error0_ = NULL;
	GXmlDomNode* result;
	self = (GXmlElementAttributes*) base;
	g_return_val_if_fail (namespace_uri != NULL, NULL);
	g_return_val_if_fail (local_name != NULL, NULL);
	if (string_contains (local_name, ":")) {
		GError* _tmp0_;
		_tmp0_ = g_error_new (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_CHARACTER_ERROR, _ ("Invalid attribute's local name '%s': invalid use of ':' character"), local_name);
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp1_ = self->_element;
	_tmp2_ = gxml_element_lookup_prefix (_tmp1_, namespace_uri);
	nsp = _tmp2_;
	_tmp3_ = nsp;
	if (_tmp3_ == NULL) {
		GError* _tmp4_;
		_tmp4_ = g_error_new (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Namespace URI was not found: %s"), namespace_uri);
		_inner_error0_ = _tmp4_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (nsp);
		return NULL;
	}
	_tmp5_ = nsp;
	_tmp6_ = g_strconcat (_tmp5_, ":", NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strconcat (_tmp7_, local_name, NULL);
	_tmp9_ = _tmp8_;
	_tmp10_ = g_utf8_strdown (_tmp9_, (gssize) -1);
	_tmp11_ = _tmp10_;
	_g_free0 (_tmp9_);
	_g_free0 (_tmp7_);
	k = _tmp11_;
	_tmp12_ = k;
	_tmp13_ = gee_abstract_map_get ((GeeAbstractMap*) self, _tmp12_);
	v = (GXmlDomNode*) _tmp13_;
	result = v;
	_g_free0 (k);
	_g_free0 (nsp);
	return result;
}

static GXmlDomNode*
gxml_element_attributes_real_set_named_item_ns (GXmlDomNamedNodeMap* base,
                                                GXmlDomNode* node,
                                                GError** error)
{
	GXmlElementAttributes * self;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp14_ = FALSE;
	gboolean _tmp15_ = FALSE;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	gboolean _tmp19_;
	gboolean _tmp27_ = FALSE;
	gboolean _tmp28_ = FALSE;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gboolean _tmp32_;
	gboolean _tmp40_ = FALSE;
	gboolean _tmp41_ = FALSE;
	gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	gboolean _tmp45_;
	gboolean _tmp53_ = FALSE;
	gboolean _tmp54_ = FALSE;
	gchar* _tmp55_;
	gchar* _tmp56_;
	gchar* _tmp57_;
	gboolean _tmp58_;
	gboolean _tmp66_ = FALSE;
	gboolean _tmp67_ = FALSE;
	gboolean _tmp68_ = FALSE;
	gchar* _tmp69_;
	gchar* _tmp70_;
	gchar* _tmp71_;
	gboolean _tmp72_;
	gboolean _tmp85_ = FALSE;
	gboolean _tmp86_ = FALSE;
	gchar* _tmp87_;
	gchar* _tmp88_;
	gchar* _tmp89_;
	gboolean _tmp90_;
	gboolean _tmp98_ = FALSE;
	gboolean _tmp99_ = FALSE;
	gchar* _tmp100_;
	gchar* _tmp101_;
	gchar* _tmp102_;
	gboolean _tmp103_;
	gboolean _tmp111_ = FALSE;
	gchar* _tmp112_;
	gchar* _tmp113_;
	gchar* _tmp114_;
	gboolean _tmp115_;
	gboolean _tmp141_ = FALSE;
	gchar* _tmp142_;
	gchar* _tmp143_;
	gchar* _tmp144_;
	gboolean _tmp145_;
	gboolean _tmp150_ = FALSE;
	gboolean _tmp151_ = FALSE;
	gchar* _tmp152_;
	gchar* _tmp153_;
	gchar* _tmp154_;
	gboolean _tmp155_;
	gboolean _tmp173_ = FALSE;
	gboolean _tmp174_ = FALSE;
	gboolean _tmp175_ = FALSE;
	gchar* _tmp176_;
	gchar* _tmp177_;
	gchar* _tmp178_;
	gboolean _tmp179_;
	gchar* p = NULL;
	gchar* _tmp234_;
	gboolean _tmp235_ = FALSE;
	gchar* _tmp236_;
	gchar* _tmp237_;
	gchar* _tmp238_;
	gboolean _tmp239_;
	gchar* k = NULL;
	const gchar* _tmp247_;
	gchar* _tmp248_;
	gchar* _tmp249_;
	gchar* _tmp250_;
	gchar* _tmp251_;
	gchar* _tmp252_;
	gchar* _tmp253_;
	gchar* _tmp254_;
	GXmlAttr* attr = NULL;
	GParamSpec* pprop = NULL;
	GXmlElement* _tmp255_;
	const gchar* _tmp256_;
	GParamSpec* _tmp257_;
	GParamSpec* _tmp258_;
	const gchar* _tmp281_;
	GXmlAttr* _tmp282_;
	GeeTreeMap* _tmp283_;
	gint _tmp284_;
	gint _tmp285_;
	const gchar* _tmp286_;
	GError* _inner_error0_ = NULL;
	GXmlDomNode* result;
	self = (GXmlElementAttributes*) base;
	g_return_val_if_fail (node != NULL, NULL);
	_tmp1_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strcmp0 (_tmp3_, "") == 0;
	_g_free0 (_tmp3_);
	if (_tmp4_) {
		_tmp0_ = TRUE;
	} else {
		gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp5_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp0_ = string_contains (_tmp7_, ":");
		_g_free0 (_tmp7_);
	}
	if (_tmp0_) {
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		GError* _tmp11_;
		GError* _tmp12_;
		_tmp8_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp9_ = _tmp8_;
		_tmp10_ = _tmp9_;
		_tmp11_ = g_error_new (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_CHARACTER_ERROR, _ ("Invalid attribute name: %s"), _tmp10_);
		_tmp12_ = _tmp11_;
		_g_free0 (_tmp10_);
		_inner_error0_ = _tmp12_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (!GXML_IS_ATTR (node)) {
		GError* _tmp13_;
		_tmp13_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Invalid node type. GXml.Attr was expected"));
		_inner_error0_ = _tmp13_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp16_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp17_ = _tmp16_;
	_tmp18_ = _tmp17_;
	_tmp19_ = g_strcmp0 (_tmp18_, "xmlns") == 0;
	_g_free0 (_tmp18_);
	if (_tmp19_) {
		gchar* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		_tmp20_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp21_ = _tmp20_;
		_tmp22_ = _tmp21_;
		_tmp15_ = g_strcmp0 (_tmp22_, "http://www.w3.org/2000/xmlns/") != 0;
		_g_free0 (_tmp22_);
	} else {
		_tmp15_ = FALSE;
	}
	if (_tmp15_) {
		gchar* _tmp23_;
		gchar* _tmp24_;
		gchar* _tmp25_;
		_tmp23_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp24_ = _tmp23_;
		_tmp25_ = _tmp24_;
		_tmp14_ = g_strcmp0 (_tmp25_, "http://www.w3.org/2000/xmlns") != 0;
		_g_free0 (_tmp25_);
	} else {
		_tmp14_ = FALSE;
	}
	if (_tmp14_) {
		GError* _tmp26_;
		_tmp26_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Namespace attributes prefixed with 'xmlns' should use a namespace uri " \
"http://www.w3.org/2000/xmlns"));
		_inner_error0_ = _tmp26_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp29_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp30_ = _tmp29_;
	_tmp31_ = _tmp30_;
	_tmp32_ = g_strcmp0 (_tmp31_, "xml") == 0;
	_g_free0 (_tmp31_);
	if (_tmp32_) {
		gchar* _tmp33_;
		gchar* _tmp34_;
		gchar* _tmp35_;
		_tmp33_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp34_ = _tmp33_;
		_tmp35_ = _tmp34_;
		_tmp28_ = g_strcmp0 (_tmp35_, "http://www.w3.org/XML/1998/namespace/") != 0;
		_g_free0 (_tmp35_);
	} else {
		_tmp28_ = FALSE;
	}
	if (_tmp28_) {
		gchar* _tmp36_;
		gchar* _tmp37_;
		gchar* _tmp38_;
		_tmp36_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp37_ = _tmp36_;
		_tmp38_ = _tmp37_;
		_tmp27_ = g_strcmp0 (_tmp38_, "http://www.w3.org/XML/1998/namespace") != 0;
		_g_free0 (_tmp38_);
	} else {
		_tmp27_ = FALSE;
	}
	if (_tmp27_) {
		GError* _tmp39_;
		_tmp39_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Namespace attributes prefixed with 'xml' should use a namespace uri ht" \
"tp://www.w3.org/XML/1998/namespace"));
		_inner_error0_ = _tmp39_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp42_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp43_ = _tmp42_;
	_tmp44_ = _tmp43_;
	_tmp45_ = g_strcmp0 (_tmp44_, "xsi") == 0;
	_g_free0 (_tmp44_);
	if (_tmp45_) {
		gchar* _tmp46_;
		gchar* _tmp47_;
		gchar* _tmp48_;
		_tmp46_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp47_ = _tmp46_;
		_tmp48_ = _tmp47_;
		_tmp41_ = g_strcmp0 (_tmp48_, "http://www.w3.org/2001/XMLSchema-instance/") != 0;
		_g_free0 (_tmp48_);
	} else {
		_tmp41_ = FALSE;
	}
	if (_tmp41_) {
		gchar* _tmp49_;
		gchar* _tmp50_;
		gchar* _tmp51_;
		_tmp49_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp50_ = _tmp49_;
		_tmp51_ = _tmp50_;
		_tmp40_ = g_strcmp0 (_tmp51_, "http://www.w3.org/2001/XMLSchema-instance") != 0;
		_g_free0 (_tmp51_);
	} else {
		_tmp40_ = FALSE;
	}
	if (_tmp40_) {
		GError* _tmp52_;
		_tmp52_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Namespace attributes prefixed with 'xsi' should use a namespace uri ht" \
"tp://www.w3.org/2001/XMLSchema-instance"));
		_inner_error0_ = _tmp52_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp55_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp56_ = _tmp55_;
	_tmp57_ = _tmp56_;
	_tmp58_ = g_strcmp0 (_tmp57_, "html") == 0;
	_g_free0 (_tmp57_);
	if (_tmp58_) {
		gchar* _tmp59_;
		gchar* _tmp60_;
		gchar* _tmp61_;
		_tmp59_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp60_ = _tmp59_;
		_tmp61_ = _tmp60_;
		_tmp54_ = g_strcmp0 (_tmp61_, "http://www.w3.org/1999/xhtml/") != 0;
		_g_free0 (_tmp61_);
	} else {
		_tmp54_ = FALSE;
	}
	if (_tmp54_) {
		gchar* _tmp62_;
		gchar* _tmp63_;
		gchar* _tmp64_;
		_tmp62_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp63_ = _tmp62_;
		_tmp64_ = _tmp63_;
		_tmp53_ = g_strcmp0 (_tmp64_, "http://www.w3.org/1999/xhtml") != 0;
		_g_free0 (_tmp64_);
	} else {
		_tmp53_ = FALSE;
	}
	if (_tmp53_) {
		GError* _tmp65_;
		_tmp65_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Namespace attributes prefixed with 'html' should use a namespace uri h" \
"ttp://www.w3.org/1999/xhtml"));
		_inner_error0_ = _tmp65_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp69_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp70_ = _tmp69_;
	_tmp71_ = _tmp70_;
	_tmp72_ = _tmp71_ != NULL;
	_g_free0 (_tmp71_);
	if (_tmp72_) {
		gchar* _tmp73_;
		gchar* _tmp74_;
		gchar* _tmp75_;
		gchar* _tmp76_;
		gchar* _tmp77_;
		_tmp73_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp74_ = _tmp73_;
		_tmp75_ = _tmp74_;
		_tmp76_ = g_utf8_strdown (_tmp75_, (gssize) -1);
		_tmp77_ = _tmp76_;
		_tmp68_ = g_strcmp0 (_tmp77_, "mathml") == 0;
		_g_free0 (_tmp77_);
		_g_free0 (_tmp75_);
	} else {
		_tmp68_ = FALSE;
	}
	if (_tmp68_) {
		gchar* _tmp78_;
		gchar* _tmp79_;
		gchar* _tmp80_;
		_tmp78_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp79_ = _tmp78_;
		_tmp80_ = _tmp79_;
		_tmp67_ = g_strcmp0 (_tmp80_, "http://www.w3.org/1998/Math/MathML/") != 0;
		_g_free0 (_tmp80_);
	} else {
		_tmp67_ = FALSE;
	}
	if (_tmp67_) {
		gchar* _tmp81_;
		gchar* _tmp82_;
		gchar* _tmp83_;
		_tmp81_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp82_ = _tmp81_;
		_tmp83_ = _tmp82_;
		_tmp66_ = g_strcmp0 (_tmp83_, "http://www.w3.org/1998/Math/MathML") != 0;
		_g_free0 (_tmp83_);
	} else {
		_tmp66_ = FALSE;
	}
	if (_tmp66_) {
		GError* _tmp84_;
		_tmp84_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Namespace attributes prefixed with 'MathML' should use a namespace uri" \
" http://www.w3.org/1998/Math/MathML"));
		_inner_error0_ = _tmp84_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp87_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp88_ = _tmp87_;
	_tmp89_ = _tmp88_;
	_tmp90_ = g_strcmp0 (_tmp89_, "xlink") == 0;
	_g_free0 (_tmp89_);
	if (_tmp90_) {
		gchar* _tmp91_;
		gchar* _tmp92_;
		gchar* _tmp93_;
		_tmp91_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp92_ = _tmp91_;
		_tmp93_ = _tmp92_;
		_tmp86_ = g_strcmp0 (_tmp93_, "http://www.w3.org/1999/xlink/") != 0;
		_g_free0 (_tmp93_);
	} else {
		_tmp86_ = FALSE;
	}
	if (_tmp86_) {
		gchar* _tmp94_;
		gchar* _tmp95_;
		gchar* _tmp96_;
		_tmp94_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp95_ = _tmp94_;
		_tmp96_ = _tmp95_;
		_tmp85_ = g_strcmp0 (_tmp96_, "http://www.w3.org/1999/xlink") != 0;
		_g_free0 (_tmp96_);
	} else {
		_tmp85_ = FALSE;
	}
	if (_tmp85_) {
		GError* _tmp97_;
		_tmp97_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Namespace attributes prefixed with 'xlink' should use a namespace uri " \
"http://www.w3.org/1999/xlink"));
		_inner_error0_ = _tmp97_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp100_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp101_ = _tmp100_;
	_tmp102_ = _tmp101_;
	_tmp103_ = g_strcmp0 (_tmp102_, "svg") == 0;
	_g_free0 (_tmp102_);
	if (_tmp103_) {
		gchar* _tmp104_;
		gchar* _tmp105_;
		gchar* _tmp106_;
		_tmp104_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp105_ = _tmp104_;
		_tmp106_ = _tmp105_;
		_tmp99_ = g_strcmp0 (_tmp106_, "http://www.w3.org/2000/svg") != 0;
		_g_free0 (_tmp106_);
	} else {
		_tmp99_ = FALSE;
	}
	if (_tmp99_) {
		gchar* _tmp107_;
		gchar* _tmp108_;
		gchar* _tmp109_;
		_tmp107_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp108_ = _tmp107_;
		_tmp109_ = _tmp108_;
		_tmp98_ = g_strcmp0 (_tmp109_, "http://www.w3.org/2000/svg") != 0;
		_g_free0 (_tmp109_);
	} else {
		_tmp98_ = FALSE;
	}
	if (_tmp98_) {
		GError* _tmp110_;
		_tmp110_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Namespace attributes prefixed with 'svg' should use a namespace uri ht" \
"tp://www.w3.org/2000/svg"));
		_inner_error0_ = _tmp110_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp112_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp113_ = _tmp112_;
	_tmp114_ = _tmp113_;
	_tmp115_ = g_strcmp0 (_tmp114_, "") == 0;
	_g_free0 (_tmp114_);
	if (_tmp115_) {
		_tmp111_ = TRUE;
	} else {
		gboolean _tmp116_ = FALSE;
		gchar* _tmp117_;
		gchar* _tmp118_;
		gchar* _tmp119_;
		gboolean _tmp120_;
		_tmp117_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp118_ = _tmp117_;
		_tmp119_ = _tmp118_;
		_tmp120_ = _tmp119_ == NULL;
		_g_free0 (_tmp119_);
		if (_tmp120_) {
			gchar* _tmp121_;
			gchar* _tmp122_;
			gchar* _tmp123_;
			_tmp121_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
			_tmp122_ = _tmp121_;
			_tmp123_ = _tmp122_;
			_tmp116_ = g_strcmp0 (_tmp123_, "xmlns") != 0;
			_g_free0 (_tmp123_);
		} else {
			_tmp116_ = FALSE;
		}
		_tmp111_ = _tmp116_;
	}
	if (_tmp111_) {
		gchar* s = NULL;
		gchar* _tmp124_;
		gchar* _tmp125_;
		gchar* _tmp126_;
		gchar* _tmp127_;
		gchar* _tmp128_;
		gboolean _tmp129_;
		const gchar* _tmp139_;
		GError* _tmp140_;
		_tmp124_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp125_ = _tmp124_;
		s = _tmp125_;
		_tmp126_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp127_ = _tmp126_;
		_tmp128_ = _tmp127_;
		_tmp129_ = _tmp128_ != NULL;
		_g_free0 (_tmp128_);
		if (_tmp129_) {
			const gchar* _tmp130_;
			gchar* _tmp131_;
			gchar* _tmp132_;
			gchar* _tmp133_;
			gchar* _tmp134_;
			gchar* _tmp135_;
			gchar* _tmp136_;
			gchar* _tmp137_;
			gchar* _tmp138_;
			_tmp130_ = s;
			_tmp131_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
			_tmp132_ = _tmp131_;
			_tmp133_ = _tmp132_;
			_tmp134_ = g_strconcat ("=<", _tmp133_, NULL);
			_tmp135_ = _tmp134_;
			_tmp136_ = g_strconcat (_tmp135_, ">", NULL);
			_tmp137_ = _tmp136_;
			_tmp138_ = g_strconcat (_tmp130_, _tmp137_, NULL);
			_g_free0 (s);
			s = _tmp138_;
			_g_free0 (_tmp137_);
			_g_free0 (_tmp135_);
			_g_free0 (_tmp133_);
		}
		_tmp139_ = s;
		_tmp140_ = g_error_new (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Namespaced attributes should provide a non-null, non-empty prefix: %s"), _tmp139_);
		_inner_error0_ = _tmp140_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (s);
		return NULL;
	}
	_tmp142_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp143_ = _tmp142_;
	_tmp144_ = _tmp143_;
	_tmp145_ = g_strcmp0 (_tmp144_, "xmlns") == 0;
	_g_free0 (_tmp144_);
	if (_tmp145_) {
		gchar* _tmp146_;
		gchar* _tmp147_;
		gchar* _tmp148_;
		_tmp146_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp147_ = _tmp146_;
		_tmp148_ = _tmp147_;
		_tmp141_ = g_strcmp0 (_tmp148_, "xmlns") == 0;
		_g_free0 (_tmp148_);
	} else {
		_tmp141_ = FALSE;
	}
	if (_tmp141_) {
		GError* _tmp149_;
		_tmp149_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace attribute's name."));
		_inner_error0_ = _tmp149_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp152_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp153_ = _tmp152_;
	_tmp154_ = _tmp153_;
	_tmp155_ = g_strcmp0 (_tmp154_, "xmlns") == 0;
	_g_free0 (_tmp154_);
	if (_tmp155_) {
		_tmp151_ = TRUE;
	} else {
		gchar* _tmp156_;
		gchar* _tmp157_;
		gchar* _tmp158_;
		_tmp156_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp157_ = _tmp156_;
		_tmp158_ = _tmp157_;
		_tmp151_ = g_strcmp0 (_tmp158_, "xmlns") == 0;
		_g_free0 (_tmp158_);
	}
	if (_tmp151_) {
		_tmp150_ = TRUE;
	} else {
		gchar* _tmp159_;
		gchar* _tmp160_;
		gchar* _tmp161_;
		_tmp159_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp160_ = _tmp159_;
		_tmp161_ = _tmp160_;
		_tmp150_ = g_strcmp0 (_tmp161_, "xsi") == 0;
		_g_free0 (_tmp161_);
	}
	if (_tmp150_) {
		gchar* asp = NULL;
		GXmlElement* _tmp162_;
		gchar* _tmp163_;
		gchar* _tmp164_;
		gchar* _tmp165_;
		gchar* _tmp166_;
		gchar* _tmp167_;
		gchar* _tmp168_;
		gchar* _tmp169_;
		gchar* _tmp170_;
		const gchar* _tmp171_;
		_tmp162_ = self->_element;
		_tmp163_ = gxml_dom_node_get_node_value (node);
		_tmp164_ = _tmp163_;
		_tmp165_ = _tmp164_;
		_tmp166_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp167_ = _tmp166_;
		_tmp168_ = _tmp167_;
		_tmp169_ = gxml_dom_element_get_attribute_ns ((GXmlDomElement*) _tmp162_, _tmp165_, _tmp168_);
		_tmp170_ = _tmp169_;
		_g_free0 (_tmp168_);
		_g_free0 (_tmp165_);
		asp = _tmp170_;
		_tmp171_ = asp;
		if (_tmp171_ != NULL) {
			GXmlDomNode* _tmp172_;
			_tmp172_ = _g_object_ref0 (node);
			result = _tmp172_;
			_g_free0 (asp);
			return result;
		}
		_g_free0 (asp);
	}
	_tmp176_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp177_ = _tmp176_;
	_tmp178_ = _tmp177_;
	_tmp179_ = g_strcmp0 (_tmp178_, "http://www.w3.org/2000/xmlns/") != 0;
	_g_free0 (_tmp178_);
	if (_tmp179_) {
		gchar* _tmp180_;
		gchar* _tmp181_;
		gchar* _tmp182_;
		_tmp180_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp181_ = _tmp180_;
		_tmp182_ = _tmp181_;
		_tmp175_ = g_strcmp0 (_tmp182_, "http://www.w3.org/2000/xmlns") != 0;
		_g_free0 (_tmp182_);
	} else {
		_tmp175_ = FALSE;
	}
	if (_tmp175_) {
		gchar* _tmp183_;
		gchar* _tmp184_;
		gchar* _tmp185_;
		_tmp183_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp184_ = _tmp183_;
		_tmp185_ = _tmp184_;
		_tmp174_ = g_strcmp0 (_tmp185_, "http://www.w3.org/2001/XMLSchema-instance/") != 0;
		_g_free0 (_tmp185_);
	} else {
		_tmp174_ = FALSE;
	}
	if (_tmp174_) {
		gchar* _tmp186_;
		gchar* _tmp187_;
		gchar* _tmp188_;
		_tmp186_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp187_ = _tmp186_;
		_tmp188_ = _tmp187_;
		_tmp173_ = g_strcmp0 (_tmp188_, "http://www.w3.org/2001/XMLSchema-instance") != 0;
		_g_free0 (_tmp188_);
	} else {
		_tmp173_ = FALSE;
	}
	if (_tmp173_) {
		gchar* nsn = NULL;
		GXmlElement* _tmp189_;
		gchar* _tmp190_;
		gchar* _tmp191_;
		gchar* _tmp192_;
		gchar* _tmp193_;
		gchar* _tmp194_;
		gchar* nspn = NULL;
		GXmlElement* _tmp195_;
		const gchar* _tmp196_;
		gchar* _tmp197_;
		gboolean _tmp198_ = FALSE;
		const gchar* _tmp199_;
		gchar* _tmp200_;
		gchar* _tmp201_;
		gchar* _tmp202_;
		gboolean _tmp203_;
		GXmlElement* _tmp215_;
		gchar* _tmp216_;
		gchar* _tmp217_;
		gchar* _tmp218_;
		gchar* _tmp219_;
		GXmlElement* _tmp220_;
		const gchar* _tmp221_;
		gchar* _tmp222_;
		gboolean _tmp223_ = FALSE;
		const gchar* _tmp224_;
		gchar* _tmp225_;
		gchar* _tmp226_;
		gchar* _tmp227_;
		gboolean _tmp228_;
		_tmp189_ = self->_element;
		_tmp190_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp191_ = _tmp190_;
		_tmp192_ = _tmp191_;
		_tmp193_ = gxml_element_lookup_namespace_uri (_tmp189_, _tmp192_);
		_tmp194_ = _tmp193_;
		_g_free0 (_tmp192_);
		nsn = _tmp194_;
		_tmp195_ = self->_element;
		_tmp196_ = nsn;
		_tmp197_ = gxml_element_lookup_prefix (_tmp195_, _tmp196_);
		nspn = _tmp197_;
		_tmp199_ = nspn;
		_tmp200_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp201_ = _tmp200_;
		_tmp202_ = _tmp201_;
		_tmp203_ = g_strcmp0 (_tmp199_, _tmp202_) != 0;
		_g_free0 (_tmp202_);
		if (_tmp203_) {
			const gchar* _tmp204_;
			gchar* _tmp205_;
			gchar* _tmp206_;
			gchar* _tmp207_;
			_tmp204_ = nsn;
			_tmp205_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
			_tmp206_ = _tmp205_;
			_tmp207_ = _tmp206_;
			_tmp198_ = g_strcmp0 (_tmp204_, _tmp207_) != 0;
			_g_free0 (_tmp207_);
		} else {
			_tmp198_ = FALSE;
		}
		if (_tmp198_) {
			gchar* _tmp208_;
			gchar* _tmp209_;
			gchar* _tmp210_;
			gchar* _tmp211_;
			gchar* _tmp212_;
			GError* _tmp213_;
			GError* _tmp214_;
			_tmp208_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
			_tmp209_ = _tmp208_;
			_tmp210_ = _tmp209_;
			_tmp211_ = g_strdup_printf (_ ("Trying to add an attribute with an undefined namespace's prefix: %s"), _tmp210_);
			_tmp212_ = _tmp211_;
			_tmp213_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _tmp212_);
			_tmp214_ = _tmp213_;
			_g_free0 (_tmp212_);
			_g_free0 (_tmp210_);
			_inner_error0_ = _tmp214_;
			g_propagate_error (error, _inner_error0_);
			_g_free0 (nspn);
			_g_free0 (nsn);
			return NULL;
		}
		_tmp215_ = self->_element;
		_tmp216_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp217_ = _tmp216_;
		_tmp218_ = _tmp217_;
		_tmp219_ = gxml_element_lookup_prefix (_tmp215_, _tmp218_);
		_g_free0 (nspn);
		nspn = _tmp219_;
		_g_free0 (_tmp218_);
		_tmp220_ = self->_element;
		_tmp221_ = nspn;
		_tmp222_ = gxml_element_lookup_namespace_uri (_tmp220_, _tmp221_);
		_g_free0 (nsn);
		nsn = _tmp222_;
		_tmp224_ = nspn;
		_tmp225_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp226_ = _tmp225_;
		_tmp227_ = _tmp226_;
		_tmp228_ = g_strcmp0 (_tmp224_, _tmp227_) != 0;
		_g_free0 (_tmp227_);
		if (_tmp228_) {
			const gchar* _tmp229_;
			gchar* _tmp230_;
			gchar* _tmp231_;
			gchar* _tmp232_;
			_tmp229_ = nsn;
			_tmp230_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
			_tmp231_ = _tmp230_;
			_tmp232_ = _tmp231_;
			_tmp223_ = g_strcmp0 (_tmp229_, _tmp232_) != 0;
			_g_free0 (_tmp232_);
		} else {
			_tmp223_ = FALSE;
		}
		if (_tmp223_) {
			GError* _tmp233_;
			_tmp233_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Trying to add an attribute with an undefined namespace's URI"));
			_inner_error0_ = _tmp233_;
			g_propagate_error (error, _inner_error0_);
			_g_free0 (nspn);
			_g_free0 (nsn);
			return NULL;
		}
		_g_free0 (nspn);
		_g_free0 (nsn);
	}
	_tmp234_ = g_strdup ("");
	p = _tmp234_;
	_tmp236_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp237_ = _tmp236_;
	_tmp238_ = _tmp237_;
	_tmp239_ = _tmp238_ != NULL;
	_g_free0 (_tmp238_);
	if (_tmp239_) {
		gchar* _tmp240_;
		gchar* _tmp241_;
		gchar* _tmp242_;
		_tmp240_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp241_ = _tmp240_;
		_tmp242_ = _tmp241_;
		_tmp235_ = g_strcmp0 (_tmp242_, "") != 0;
		_g_free0 (_tmp242_);
	} else {
		_tmp235_ = FALSE;
	}
	if (_tmp235_) {
		gchar* _tmp243_;
		gchar* _tmp244_;
		gchar* _tmp245_;
		gchar* _tmp246_;
		_tmp243_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp244_ = _tmp243_;
		_tmp245_ = _tmp244_;
		_tmp246_ = g_strconcat (_tmp245_, ":", NULL);
		_g_free0 (p);
		p = _tmp246_;
		_g_free0 (_tmp245_);
	}
	_tmp247_ = p;
	_tmp248_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
	_tmp249_ = _tmp248_;
	_tmp250_ = _tmp249_;
	_tmp251_ = g_strconcat (_tmp247_, _tmp250_, NULL);
	_tmp252_ = _tmp251_;
	_tmp253_ = g_utf8_strdown (_tmp252_, (gssize) -1);
	_tmp254_ = _tmp253_;
	_g_free0 (_tmp252_);
	_g_free0 (_tmp250_);
	k = _tmp254_;
	attr = NULL;
	_tmp255_ = self->_element;
	_tmp256_ = k;
	_tmp257_ = gxml_object_find_property_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp255_, GXML_TYPE_OBJECT, GXmlObject), _tmp256_);
	pprop = _tmp257_;
	_tmp258_ = pprop;
	if (_tmp258_ != NULL) {
		GXmlElement* _tmp259_;
		const gchar* _tmp260_;
		gchar* _tmp261_;
		gchar* _tmp262_;
		gchar* _tmp263_;
		GXmlElement* _tmp264_;
		const gchar* _tmp265_;
		GXmlAttr* _tmp266_;
		_tmp259_ = self->_element;
		_tmp260_ = k;
		_tmp261_ = gxml_dom_node_get_node_value (node);
		_tmp262_ = _tmp261_;
		_tmp263_ = _tmp262_;
		gxml_object_set_attribute (G_TYPE_CHECK_INSTANCE_CAST (_tmp259_, GXML_TYPE_OBJECT, GXmlObject), _tmp260_, _tmp263_);
		_g_free0 (_tmp263_);
		_tmp264_ = self->_element;
		_tmp265_ = k;
		_tmp266_ = gxml_attr_new_reference ((GXmlDomElement*) _tmp264_, _tmp265_);
		_g_object_unref0 (attr);
		attr = _tmp266_;
	} else {
		GXmlElement* _tmp267_;
		gchar* _tmp268_;
		gchar* _tmp269_;
		gchar* _tmp270_;
		gchar* _tmp271_;
		gchar* _tmp272_;
		gchar* _tmp273_;
		gchar* _tmp274_;
		gchar* _tmp275_;
		gchar* _tmp276_;
		gchar* _tmp277_;
		gchar* _tmp278_;
		gchar* _tmp279_;
		GXmlAttr* _tmp280_;
		_tmp267_ = self->_element;
		_tmp268_ = gxml_dom_attr_get_namespace_uri ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp269_ = _tmp268_;
		_tmp270_ = _tmp269_;
		_tmp271_ = gxml_dom_attr_get_prefix ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp272_ = _tmp271_;
		_tmp273_ = _tmp272_;
		_tmp274_ = gxml_dom_attr_get_local_name ((GXmlDomAttr*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_ATTR, GXmlAttr));
		_tmp275_ = _tmp274_;
		_tmp276_ = _tmp275_;
		_tmp277_ = gxml_dom_node_get_node_value (node);
		_tmp278_ = _tmp277_;
		_tmp279_ = _tmp278_;
		_tmp280_ = gxml_attr_new_namespace ((GXmlDomElement*) _tmp267_, _tmp270_, _tmp273_, _tmp276_, _tmp279_);
		_g_object_unref0 (attr);
		attr = _tmp280_;
		_g_free0 (_tmp279_);
		_g_free0 (_tmp276_);
		_g_free0 (_tmp273_);
		_g_free0 (_tmp270_);
	}
	_tmp281_ = k;
	_tmp282_ = attr;
	gee_abstract_map_set ((GeeAbstractMap*) self, _tmp281_, (GXmlDomNode*) _tmp282_);
	_tmp283_ = self->priv->order;
	_tmp284_ = gee_abstract_map_get_size ((GeeAbstractMap*) self);
	_tmp285_ = _tmp284_;
	_tmp286_ = k;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp283_, (gpointer) ((gintptr) (_tmp285_ - 1)), _tmp286_);
	result = (GXmlDomNode*) attr;
	_g_param_spec_unref0 (pprop);
	_g_free0 (k);
	_g_free0 (p);
	return result;
}

static glong
gxml_element_attributes_index_of (GXmlElementAttributes* self,
                                  const gchar* name)
{
	glong i = 0L;
	glong result;
	g_return_val_if_fail (self != NULL, -1L);
	g_return_val_if_fail (name != NULL, -1L);
	i = (glong) -1;
	{
		GeeIterator* _e_it = NULL;
		GeeTreeMap* _tmp0_;
		GeeSortedSet* _tmp1_;
		GeeSortedSet* _tmp2_;
		GeeSortedSet* _tmp3_;
		GeeIterator* _tmp4_;
		GeeIterator* _tmp5_;
		_tmp0_ = self->priv->order;
		_tmp1_ = gee_abstract_sorted_map_get_ascending_entries ((GeeAbstractSortedMap*) _tmp0_);
		_tmp2_ = _tmp1_;
		_tmp3_ = _tmp2_;
		_tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
		_tmp5_ = _tmp4_;
		_g_object_unref0 (_tmp3_);
		_e_it = _tmp5_;
		while (TRUE) {
			GeeIterator* _tmp6_;
			GeeMapEntry* e = NULL;
			GeeIterator* _tmp7_;
			gpointer _tmp8_;
			glong _tmp9_;
			GeeMapEntry* _tmp10_;
			gconstpointer _tmp11_;
			gconstpointer _tmp12_;
			_tmp6_ = _e_it;
			if (!gee_iterator_next (_tmp6_)) {
				break;
			}
			_tmp7_ = _e_it;
			_tmp8_ = gee_iterator_get (_tmp7_);
			e = (GeeMapEntry*) _tmp8_;
			_tmp9_ = i;
			i = _tmp9_ + 1;
			_tmp10_ = e;
			_tmp11_ = gee_map_entry_get_value (_tmp10_);
			_tmp12_ = _tmp11_;
			if (g_strcmp0 ((const gchar*) _tmp12_, name) == 0) {
				result = i;
				_g_object_unref0 (e);
				_g_object_unref0 (_e_it);
				return result;
			}
			_g_object_unref0 (e);
		}
		_g_object_unref0 (_e_it);
	}
	result = (glong) -1;
	return result;
}

void
gxml_element_attributes_add_reference (GXmlElementAttributes* self,
                                       const gchar* name)
{
	GXmlAttr* attr = NULL;
	GXmlElement* _tmp0_;
	GXmlAttr* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GeeTreeMap* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = self->_element;
	_tmp1_ = gxml_attr_new_reference ((GXmlDomElement*) _tmp0_, name);
	attr = _tmp1_;
	_tmp2_ = g_utf8_strdown (name, (gssize) -1);
	_tmp3_ = _tmp2_;
	gee_abstract_map_set ((GeeAbstractMap*) self, _tmp3_, (GXmlDomNode*) attr);
	_g_free0 (_tmp3_);
	_tmp4_ = self->priv->order;
	_tmp5_ = gee_abstract_map_get_size ((GeeAbstractMap*) self);
	_tmp6_ = _tmp5_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, (gpointer) ((gintptr) _tmp6_), name);
	_g_object_unref0 (attr);
}

static void
gxml_element_attributes_class_init (GXmlElementAttributesClass * klass,
                                    gpointer klass_data)
{
	gxml_element_attributes_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GXmlElementAttributes_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_element_attributes_get_property;
	G_OBJECT_CLASS (klass)->finalize = gxml_element_attributes_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_ATTRIBUTES_LENGTH_PROPERTY, gxml_element_attributes_properties[GXML_ELEMENT_ATTRIBUTES_LENGTH_PROPERTY] = g_param_spec_int ("length", "length", "length", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gxml_element_attributes_gxml_dom_named_node_map_interface_init (GXmlDomNamedNodeMapIface * iface,
                                                                gpointer iface_data)
{
	gxml_element_attributes_gxml_dom_named_node_map_parent_iface = g_type_interface_peek_parent (iface);
	iface->item = (GXmlDomNode* (*) (GXmlDomNamedNodeMap*, gint)) gxml_element_attributes_real_item;
	iface->get_named_item = (GXmlDomNode* (*) (GXmlDomNamedNodeMap*, const gchar*)) gxml_element_attributes_real_get_named_item;
	iface->set_named_item = (GXmlDomNode* (*) (GXmlDomNamedNodeMap*, GXmlDomNode*, GError**)) gxml_element_attributes_real_set_named_item;
	iface->remove_named_item = (GXmlDomNode* (*) (GXmlDomNamedNodeMap*, const gchar*, GError**)) gxml_element_attributes_real_remove_named_item;
	iface->remove_named_item_ns = (GXmlDomNode* (*) (GXmlDomNamedNodeMap*, const gchar*, const gchar*, GError**)) gxml_element_attributes_real_remove_named_item_ns;
	iface->get_named_item_ns = (GXmlDomNode* (*) (GXmlDomNamedNodeMap*, const gchar*, const gchar*, GError**)) gxml_element_attributes_real_get_named_item_ns;
	iface->set_named_item_ns = (GXmlDomNode* (*) (GXmlDomNamedNodeMap*, GXmlDomNode*, GError**)) gxml_element_attributes_real_set_named_item_ns;
	iface->get_length = gxml_element_attributes_real_get_length;
}

static void
gxml_element_attributes_instance_init (GXmlElementAttributes * self,
                                       gpointer klass)
{
	GeeTreeMap* _tmp0_;
	self->priv = gxml_element_attributes_get_instance_private (self);
	_tmp0_ = gee_tree_map_new (G_TYPE_LONG, NULL, NULL, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->order = _tmp0_;
}

static void
gxml_element_attributes_finalize (GObject * obj)
{
	GXmlElementAttributes * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_ELEMENT_TYPE_ATTRIBUTES, GXmlElementAttributes);
	_g_object_unref0 (self->priv->order);
	_g_object_unref0 (self->_element);
	G_OBJECT_CLASS (gxml_element_attributes_parent_class)->finalize (obj);
}

/**
   * Holds attributes in current node, using attribute's name as key
   * and it's value as value. Appends namespace prefix to attribute's name as
   * key if is a namespaced attribute.
   */
static GType
gxml_element_attributes_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlElementAttributesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_element_attributes_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlElementAttributes), 0, (GInstanceInitFunc) gxml_element_attributes_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_named_node_map_info = { (GInterfaceInitFunc) gxml_element_attributes_gxml_dom_named_node_map_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_element_attributes_type_id;
	gxml_element_attributes_type_id = g_type_register_static (GEE_TYPE_HASH_MAP, "GXmlElementAttributes", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_element_attributes_type_id, GXML_TYPE_DOM_NAMED_NODE_MAP, &gxml_dom_named_node_map_info);
	GXmlElementAttributes_private_offset = g_type_add_instance_private (gxml_element_attributes_type_id, sizeof (GXmlElementAttributesPrivate));
	return gxml_element_attributes_type_id;
}

GType
gxml_element_attributes_get_type (void)
{
	static volatile gsize gxml_element_attributes_type_id__once = 0;
	if (g_once_init_enter (&gxml_element_attributes_type_id__once)) {
		GType gxml_element_attributes_type_id;
		gxml_element_attributes_type_id = gxml_element_attributes_get_type_once ();
		g_once_init_leave (&gxml_element_attributes_type_id__once, gxml_element_attributes_type_id);
	}
	return gxml_element_attributes_type_id__once;
}

static void
_vala_gxml_element_attributes_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	GXmlElementAttributes * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_ELEMENT_TYPE_ATTRIBUTES, GXmlElementAttributes);
	switch (property_id) {
		case GXML_ELEMENT_ATTRIBUTES_LENGTH_PROPERTY:
		g_value_set_int (value, gxml_dom_named_node_map_get_length ((GXmlDomNamedNodeMap*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static void
_gxml_element___lambda6_ (GXmlElement* self,
                          GParamSpec* pspec)
{
	const gchar* _tmp0_;
	g_return_if_fail (pspec != NULL);
	_tmp0_ = g_param_spec_get_nick (pspec);
	if (string_contains (_tmp0_, "::")) {
		gchar* name = NULL;
		const gchar* _tmp1_;
		gchar* _tmp2_;
		GXmlDomNode* p = NULL;
		GXmlElementAttributes* _tmp3_;
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gpointer _tmp7_;
		GXmlDomNode* _tmp8_;
		GXmlDomNode* _tmp9_;
		_tmp1_ = g_param_spec_get_nick (pspec);
		_tmp2_ = string_replace (_tmp1_, "::", "");
		name = _tmp2_;
		_tmp3_ = self->_attributes;
		_tmp4_ = name;
		_tmp5_ = g_utf8_strdown (_tmp4_, (gssize) -1);
		_tmp6_ = _tmp5_;
		_tmp7_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp3_, _tmp6_);
		_tmp8_ = (GXmlDomNode*) _tmp7_;
		_g_free0 (_tmp6_);
		p = _tmp8_;
		_tmp9_ = p;
		if (_tmp9_ == NULL) {
			GXmlProperty* prop = NULL;
			const gchar* _tmp10_;
			GXmlStringRef* _tmp11_;
			GXmlElementAttributes* _tmp12_;
			const gchar* _tmp13_;
			_tmp10_ = name;
			_tmp11_ = gxml_string_ref_new ((GXmlObject*) self, _tmp10_);
			prop = (GXmlProperty*) _tmp11_;
			_tmp12_ = self->_attributes;
			_tmp13_ = name;
			gxml_element_attributes_add_reference (_tmp12_, _tmp13_);
			_g_object_unref0 (prop);
		}
		_g_object_unref0 (p);
		_g_free0 (name);
	}
}

static void
__gxml_element___lambda6__g_object_notify (GObject* _sender,
                                           GParamSpec* pspec,
                                           gpointer self)
{
	_gxml_element___lambda6_ ((GXmlElement*) self, pspec);
}

static GObject *
gxml_element_constructor (GType type,
                          guint n_construct_properties,
                          GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GXmlElement * self;
	GXmlElementAttributes* _tmp0_;
	gchar* _tmp1_;
	parent_class = G_OBJECT_CLASS (gxml_element_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_ELEMENT, GXmlElement);
	((GXmlNode*) self)->_node_type = GXML_DOM_NODE_NODE_TYPE_ELEMENT_NODE;
	_tmp0_ = gxml_element_attributes_new (self);
	_g_object_unref0 (self->_attributes);
	self->_attributes = _tmp0_;
	_tmp1_ = g_strdup ("");
	_g_free0 (((GXmlNode*) self)->_local_name);
	((GXmlNode*) self)->_local_name = _tmp1_;
	g_signal_connect_object ((GObject*) self, "notify", (GCallback) __gxml_element___lambda6__g_object_notify, self, 0);
	return obj;
}

static void
gxml_element_class_init (GXmlElementClass * klass,
                         gpointer klass_data)
{
	gxml_element_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GXmlElement_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_element_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gxml_element_set_property;
	G_OBJECT_CLASS (klass)->constructor = gxml_element_constructor;
	G_OBJECT_CLASS (klass)->finalize = gxml_element_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_PREVIOUS_ELEMENT_SIBLING_PROPERTY, gxml_element_properties[GXML_ELEMENT_PREVIOUS_ELEMENT_SIBLING_PROPERTY] = g_param_spec_object ("previous-element-sibling", "previous-element-sibling", "previous-element-sibling", GXML_TYPE_DOM_ELEMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_NEXT_ELEMENT_SIBLING_PROPERTY, gxml_element_properties[GXML_ELEMENT_NEXT_ELEMENT_SIBLING_PROPERTY] = g_param_spec_object ("next-element-sibling", "next-element-sibling", "next-element-sibling", GXML_TYPE_DOM_ELEMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_CHILDREN_PROPERTY, gxml_element_properties[GXML_ELEMENT_CHILDREN_PROPERTY] = g_param_spec_object ("children", "children", "children", GXML_TYPE_DOM_HTML_COLLECTION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_FIRST_ELEMENT_CHILD_PROPERTY, gxml_element_properties[GXML_ELEMENT_FIRST_ELEMENT_CHILD_PROPERTY] = g_param_spec_object ("first-element-child", "first-element-child", "first-element-child", GXML_TYPE_DOM_ELEMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_LAST_ELEMENT_CHILD_PROPERTY, gxml_element_properties[GXML_ELEMENT_LAST_ELEMENT_CHILD_PROPERTY] = g_param_spec_object ("last-element-child", "last-element-child", "last-element-child", GXML_TYPE_DOM_ELEMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_CHILD_ELEMENT_COUNT_PROPERTY, gxml_element_properties[GXML_ELEMENT_CHILD_ELEMENT_COUNT_PROPERTY] = g_param_spec_int ("child-element-count", "child-element-count", "child-element-count", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_NAMESPACE_URI_PROPERTY, gxml_element_properties[GXML_ELEMENT_NAMESPACE_URI_PROPERTY] = g_param_spec_string ("namespace-uri", "namespace-uri", "namespace-uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_PREFIX_PROPERTY, gxml_element_properties[GXML_ELEMENT_PREFIX_PROPERTY] = g_param_spec_string ("prefix", "prefix", "prefix", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	   * Derived classes should define it at construction time, using
	   * {@link GXml.Node._local_name} field. This is the node's name.
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_LOCAL_NAME_PROPERTY, gxml_element_properties[GXML_ELEMENT_LOCAL_NAME_PROPERTY] = g_param_spec_string ("local-name", "local-name", "local-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_TAG_NAME_PROPERTY, gxml_element_properties[GXML_ELEMENT_TAG_NAME_PROPERTY] = g_param_spec_string ("tag-name", "tag-name", "tag-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	   * An attribute called 'id'.
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_ID_PROPERTY, gxml_element_properties[GXML_ELEMENT_ID_PROPERTY] = g_param_spec_string ("id", "::id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * An attribute called 'class'.
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_CLASS_NAME_PROPERTY, gxml_element_properties[GXML_ELEMENT_CLASS_NAME_PROPERTY] = g_param_spec_string ("class-name", "class-name", "class-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * A list of values of all attributes called 'class'.
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_CLASS_LIST_PROPERTY, gxml_element_properties[GXML_ELEMENT_CLASS_LIST_PROPERTY] = g_param_spec_object ("class-list", "class-list", "class-list", GXML_TYPE_DOM_TOKEN_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_ATTRIBUTES_PROPERTY, gxml_element_properties[GXML_ELEMENT_ATTRIBUTES_PROPERTY] = g_param_spec_object ("attributes", "attributes", "attributes", GXML_TYPE_DOM_NAMED_NODE_MAP, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/**
	   * If true all children are parsed. If false, all its children are stored
	   * as plain string in {@link unparsed}. In order to generate an XML tree
	   * use {@link read_unparsed}.
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_PARSE_CHILDREN_PROPERTY, gxml_element_properties[GXML_ELEMENT_PARSE_CHILDREN_PROPERTY] = g_param_spec_boolean ("parse-children", "parse-children", "parse-children", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * Temporally stores, all unparsed children as plain string. See {@link parse_children}.
	   *
	   * If it is null, means all children have been already parsed.
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_UNPARSED_PROPERTY, gxml_element_properties[GXML_ELEMENT_UNPARSED_PROPERTY] = g_param_spec_string ("unparsed", "unparsed", "unparsed", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/**
	   * On memory {@link GLib.MemoryOutputStream} with the unparsed
	   * string of the element
	   */
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_ELEMENT_READ_BUFFER_PROPERTY, gxml_element_properties[GXML_ELEMENT_READ_BUFFER_PROPERTY] = g_param_spec_object ("read-buffer", "read-buffer", "read-buffer", g_memory_output_stream_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
gxml_element_gxml_dom_child_node_interface_init (GXmlDomChildNodeIface * iface,
                                                 gpointer iface_data)
{
	gxml_element_gxml_dom_child_node_parent_iface = g_type_interface_peek_parent (iface);
	iface->remove = (void (*) (GXmlDomChildNode*)) gxml_element_real_remove;
}

static void
gxml_element_gxml_dom_non_document_type_child_node_interface_init (GXmlDomNonDocumentTypeChildNodeIface * iface,
                                                                   gpointer iface_data)
{
	gxml_element_gxml_dom_non_document_type_child_node_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_previous_element_sibling = gxml_element_real_get_previous_element_sibling;
	iface->get_next_element_sibling = gxml_element_real_get_next_element_sibling;
}

static void
gxml_element_gxml_dom_parent_node_interface_init (GXmlDomParentNodeIface * iface,
                                                  gpointer iface_data)
{
	gxml_element_gxml_dom_parent_node_parent_iface = g_type_interface_peek_parent (iface);
	iface->query_selector_all = (GXmlDomNodeList* (*) (GXmlDomParentNode*, const gchar*, GError**)) gxml_element_real_query_selector_all;
	iface->get_children = gxml_element_real_get_children;
	iface->get_first_element_child = gxml_element_real_get_first_element_child;
	iface->get_last_element_child = gxml_element_real_get_last_element_child;
	iface->get_child_element_count = gxml_element_real_get_child_element_count;
}

static void
gxml_element_gxml_dom_element_interface_init (GXmlDomElementIface * iface,
                                              gpointer iface_data)
{
	gxml_element_gxml_dom_element_parent_iface = g_type_interface_peek_parent (iface);
	iface->read_from_file = (void (*) (GXmlDomElement*, GFile*, GCancellable*, GError**)) gxml_element_real_read_from_file;
	iface->read_from_file_async = (void (*) (GXmlDomElement*, GFile*, GCancellable*, GAsyncReadyCallback, gpointer)) gxml_element_real_read_from_file_async;
	iface->read_from_file_finish = (void (*) (GXmlDomElement*, GAsyncResult*, GError**)) gxml_element_read_from_file_finish;
	iface->read_from_stream = (void (*) (GXmlDomElement*, GInputStream*, GCancellable*, GError**)) gxml_element_real_read_from_stream;
	iface->read_from_stream_async = (void (*) (GXmlDomElement*, GInputStream*, GCancellable*, GAsyncReadyCallback, gpointer)) gxml_element_real_read_from_stream_async;
	iface->read_from_stream_finish = (void (*) (GXmlDomElement*, GAsyncResult*, GError**)) gxml_element_read_from_stream_finish;
	iface->read_from_string = (void (*) (GXmlDomElement*, const gchar*, GCancellable*, GError**)) gxml_element_real_read_from_string;
	iface->read_from_string_async = (void (*) (GXmlDomElement*, const gchar*, GCancellable*, GAsyncReadyCallback, gpointer)) gxml_element_real_read_from_string_async;
	iface->read_from_string_finish = (void (*) (GXmlDomElement*, GAsyncResult*, GError**)) gxml_element_read_from_string_finish;
	iface->write_string = (gchar* (*) (GXmlDomElement*, GCancellable*, GError**)) gxml_element_real_write_string;
	iface->write_string_async = (void (*) (GXmlDomElement*, GCancellable*, GAsyncReadyCallback, gpointer)) gxml_element_real_write_string_async;
	iface->write_string_finish = (gchar* (*) (GXmlDomElement*, GAsyncResult*, GError**)) gxml_element_write_string_finish;
	iface->write_file = (void (*) (GXmlDomElement*, GFile*, GCancellable*, GError**)) gxml_element_real_write_file;
	iface->write_file_async = (void (*) (GXmlDomElement*, GFile*, GCancellable*, GAsyncReadyCallback, gpointer)) gxml_element_real_write_file_async;
	iface->write_file_finish = (void (*) (GXmlDomElement*, GAsyncResult*, GError**)) gxml_element_write_file_finish;
	iface->write_stream = (void (*) (GXmlDomElement*, GOutputStream*, GError**)) gxml_element_real_write_stream;
	iface->write_stream_async = (void (*) (GXmlDomElement*, GOutputStream*, GCancellable*, GAsyncReadyCallback, gpointer)) gxml_element_real_write_stream_async;
	iface->write_stream_finish = (void (*) (GXmlDomElement*, GAsyncResult*, GError**)) gxml_element_write_stream_finish;
	iface->create_stream = (GInputStream* (*) (GXmlDomElement*, GError**)) gxml_element_real_create_stream;
	iface->create_stream_async = (void (*) (GXmlDomElement*, GCancellable*, GAsyncReadyCallback, gpointer)) gxml_element_real_create_stream_async;
	iface->create_stream_finish = (GInputStream* (*) (GXmlDomElement*, GAsyncResult*, GError**)) gxml_element_create_stream_finish;
	iface->get_attribute = (gchar* (*) (GXmlDomElement*, const gchar*)) gxml_element_real_get_attribute;
	iface->get_attribute_ns = (gchar* (*) (GXmlDomElement*, const gchar*, const gchar*)) gxml_element_real_get_attribute_ns;
	iface->set_attribute = (void (*) (GXmlDomElement*, const gchar*, const gchar*, GError**)) gxml_element_real_set_attribute;
	iface->set_attribute_ns = (void (*) (GXmlDomElement*, const gchar*, const gchar*, const gchar*, GError**)) gxml_element_real_set_attribute_ns;
	iface->remove_attribute = (void (*) (GXmlDomElement*, const gchar*)) gxml_element_real_remove_attribute;
	iface->remove_attribute_ns = (void (*) (GXmlDomElement*, const gchar*, const gchar*)) gxml_element_real_remove_attribute_ns;
	iface->has_attribute = (gboolean (*) (GXmlDomElement*, const gchar*)) gxml_element_real_has_attribute;
	iface->has_attribute_ns = (gboolean (*) (GXmlDomElement*, const gchar*, const gchar*)) gxml_element_real_has_attribute_ns;
	iface->get_elements_by_tag_name = (GXmlDomHTMLCollection* (*) (GXmlDomElement*, const gchar*)) gxml_element_real_get_elements_by_tag_name;
	iface->get_elements_by_tag_name_ns = (GXmlDomHTMLCollection* (*) (GXmlDomElement*, const gchar*, const gchar*)) gxml_element_real_get_elements_by_tag_name_ns;
	iface->get_elements_by_class_name = (GXmlDomHTMLCollection* (*) (GXmlDomElement*, const gchar*)) gxml_element_real_get_elements_by_class_name;
	iface->get_namespace_uri = gxml_element_real_get_namespace_uri;
	iface->get_prefix = gxml_element_real_get_prefix;
	iface->get_local_name = gxml_element_real_get_local_name;
	iface->get_tag_name = gxml_element_real_get_tag_name;
	iface->get_id = gxml_element_real_get_id;
	iface->set_id = gxml_element_real_set_id;
	iface->get_class_name = gxml_element_real_get_class_name;
	iface->set_class_name = gxml_element_real_set_class_name;
	iface->get_class_list = gxml_element_real_get_class_list;
	iface->get_attributes = gxml_element_real_get_attributes;
}

static void
gxml_element_gxml_object_interface_init (GXmlObjectIface * iface,
                                         gpointer iface_data)
{
	gxml_element_gxml_object_parent_iface = g_type_interface_peek_parent (iface);
}

static void
gxml_element_instance_init (GXmlElement * self,
                            gpointer klass)
{
	self->priv = gxml_element_get_instance_private (self);
	self->_namespace_uri = NULL;
	self->priv->_parse_children = TRUE;
	self->priv->_unparsed = NULL;
	self->priv->pool = NULL;
}

static void
gxml_element_finalize (GObject * obj)
{
	GXmlElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_ELEMENT, GXmlElement);
	_g_object_unref0 (self->_attributes);
	_g_free0 (self->_namespace_uri);
	_g_free0 (self->priv->_id);
	_g_free0 (self->priv->_unparsed);
	_g_object_unref0 (self->priv->_read_buffer);
	_g_thread_pool_free0 (self->priv->pool);
	G_OBJECT_CLASS (gxml_element_parent_class)->finalize (obj);
}

/**
 * A DOM4 implementation of {@link DomElement}, for one-step-parsing.
 *
 * This object avoids pre and post XML parsing, by using a one step parsing
 * to translate text XML tree to an GObject based tree.
 *
 * A GXml Object Model (GOM) implementation of {@link GXml.Element}. It can be
 * used transparently as {@link DomElement} in a XML tree.
 *
 * It also allows delayed parsing, so you can read large documents by parsing
 * just a XML element node and its attributes but not its children; save its
 * children as a text, for a post-on-step-parsing.
 */
static GType
gxml_element_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlElementClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_element_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlElement), 0, (GInstanceInitFunc) gxml_element_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_child_node_info = { (GInterfaceInitFunc) gxml_element_gxml_dom_child_node_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_non_document_type_child_node_info = { (GInterfaceInitFunc) gxml_element_gxml_dom_non_document_type_child_node_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_parent_node_info = { (GInterfaceInitFunc) gxml_element_gxml_dom_parent_node_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_element_info = { (GInterfaceInitFunc) gxml_element_gxml_dom_element_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_object_info = { (GInterfaceInitFunc) gxml_element_gxml_object_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_element_type_id;
	gxml_element_type_id = g_type_register_static (GXML_TYPE_NODE, "GXmlElement", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_element_type_id, GXML_TYPE_DOM_CHILD_NODE, &gxml_dom_child_node_info);
	g_type_add_interface_static (gxml_element_type_id, GXML_TYPE_DOM_NON_DOCUMENT_TYPE_CHILD_NODE, &gxml_dom_non_document_type_child_node_info);
	g_type_add_interface_static (gxml_element_type_id, GXML_TYPE_DOM_PARENT_NODE, &gxml_dom_parent_node_info);
	g_type_add_interface_static (gxml_element_type_id, GXML_TYPE_DOM_ELEMENT, &gxml_dom_element_info);
	g_type_add_interface_static (gxml_element_type_id, GXML_TYPE_OBJECT, &gxml_object_info);
	GXmlElement_private_offset = g_type_add_instance_private (gxml_element_type_id, sizeof (GXmlElementPrivate));
	return gxml_element_type_id;
}

GType
gxml_element_get_type (void)
{
	static volatile gsize gxml_element_type_id__once = 0;
	if (g_once_init_enter (&gxml_element_type_id__once)) {
		GType gxml_element_type_id;
		gxml_element_type_id = gxml_element_get_type_once ();
		g_once_init_leave (&gxml_element_type_id__once, gxml_element_type_id);
	}
	return gxml_element_type_id__once;
}

static void
_vala_gxml_element_get_property (GObject * object,
                                 guint property_id,
                                 GValue * value,
                                 GParamSpec * pspec)
{
	GXmlElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_ELEMENT, GXmlElement);
	switch (property_id) {
		case GXML_ELEMENT_PREVIOUS_ELEMENT_SIBLING_PROPERTY:
		g_value_take_object (value, gxml_dom_non_document_type_child_node_get_previous_element_sibling ((GXmlDomNonDocumentTypeChildNode*) self));
		break;
		case GXML_ELEMENT_NEXT_ELEMENT_SIBLING_PROPERTY:
		g_value_take_object (value, gxml_dom_non_document_type_child_node_get_next_element_sibling ((GXmlDomNonDocumentTypeChildNode*) self));
		break;
		case GXML_ELEMENT_CHILDREN_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_children ((GXmlDomParentNode*) self));
		break;
		case GXML_ELEMENT_FIRST_ELEMENT_CHILD_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_first_element_child ((GXmlDomParentNode*) self));
		break;
		case GXML_ELEMENT_LAST_ELEMENT_CHILD_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_last_element_child ((GXmlDomParentNode*) self));
		break;
		case GXML_ELEMENT_CHILD_ELEMENT_COUNT_PROPERTY:
		g_value_set_int (value, gxml_dom_parent_node_get_child_element_count ((GXmlDomParentNode*) self));
		break;
		case GXML_ELEMENT_NAMESPACE_URI_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_namespace_uri ((GXmlDomElement*) self));
		break;
		case GXML_ELEMENT_PREFIX_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_prefix ((GXmlDomElement*) self));
		break;
		case GXML_ELEMENT_LOCAL_NAME_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_local_name ((GXmlDomElement*) self));
		break;
		case GXML_ELEMENT_TAG_NAME_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_tag_name ((GXmlDomElement*) self));
		break;
		case GXML_ELEMENT_ID_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_id ((GXmlDomElement*) self));
		break;
		case GXML_ELEMENT_CLASS_NAME_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_class_name ((GXmlDomElement*) self));
		break;
		case GXML_ELEMENT_CLASS_LIST_PROPERTY:
		g_value_take_object (value, gxml_dom_element_get_class_list ((GXmlDomElement*) self));
		break;
		case GXML_ELEMENT_ATTRIBUTES_PROPERTY:
		g_value_take_object (value, gxml_dom_element_get_attributes ((GXmlDomElement*) self));
		break;
		case GXML_ELEMENT_PARSE_CHILDREN_PROPERTY:
		g_value_set_boolean (value, gxml_element_get_parse_children (self));
		break;
		case GXML_ELEMENT_UNPARSED_PROPERTY:
		g_value_set_string (value, gxml_element_get_unparsed (self));
		break;
		case GXML_ELEMENT_READ_BUFFER_PROPERTY:
		g_value_set_object (value, gxml_element_get_read_buffer (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gxml_element_set_property (GObject * object,
                                 guint property_id,
                                 const GValue * value,
                                 GParamSpec * pspec)
{
	GXmlElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_ELEMENT, GXmlElement);
	switch (property_id) {
		case GXML_ELEMENT_ID_PROPERTY:
		gxml_dom_element_set_id ((GXmlDomElement*) self, g_value_get_string (value));
		break;
		case GXML_ELEMENT_CLASS_NAME_PROPERTY:
		gxml_dom_element_set_class_name ((GXmlDomElement*) self, g_value_get_string (value));
		break;
		case GXML_ELEMENT_PARSE_CHILDREN_PROPERTY:
		gxml_element_set_parse_children (self, g_value_get_boolean (value));
		break;
		case GXML_ELEMENT_UNPARSED_PROPERTY:
		gxml_element_set_unparsed (self, g_value_get_string (value));
		break;
		case GXML_ELEMENT_READ_BUFFER_PROPERTY:
		gxml_element_set_read_buffer (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

