/* Node.c generated by valac 0.56.19, the Vala compiler
 * generated from Node.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 <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_NODE_0_PROPERTY,
	GXML_NODE_NODE_TYPE_PROPERTY,
	GXML_NODE_NODE_NAME_PROPERTY,
	GXML_NODE_BASE_URI_PROPERTY,
	GXML_NODE_OWNER_DOCUMENT_PROPERTY,
	GXML_NODE_PARENT_NODE_PROPERTY,
	GXML_NODE_PARENT_ELEMENT_PROPERTY,
	GXML_NODE_CHILD_NODES_PROPERTY,
	GXML_NODE_FIRST_CHILD_PROPERTY,
	GXML_NODE_LAST_CHILD_PROPERTY,
	GXML_NODE_PREVIOUS_SIBLING_PROPERTY,
	GXML_NODE_NEXT_SIBLING_PROPERTY,
	GXML_NODE_NODE_VALUE_PROPERTY,
	GXML_NODE_TEXT_CONTENT_PROPERTY,
	GXML_NODE_NUM_PROPERTIES
};
static GParamSpec* gxml_node_properties[GXML_NODE_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	GXML_NODE_LIST_0_PROPERTY,
	GXML_NODE_LIST_LENGTH_PROPERTY,
	GXML_NODE_LIST_NUM_PROPERTIES
};
static GParamSpec* gxml_node_list_properties[GXML_NODE_LIST_NUM_PROPERTIES];

static gpointer gxml_node_parent_class = NULL;
static GXmlDomEventTargetIface * gxml_node_gxml_dom_event_target_parent_iface = NULL;
static GXmlDomNodeIface * gxml_node_gxml_dom_node_parent_iface = NULL;
static gpointer gxml_node_list_parent_class = NULL;
static GXmlDomNodeListIface * gxml_node_list_gxml_dom_node_list_parent_iface = NULL;

static gboolean gxml_node_real_has_child_nodes (GXmlDomNode* base);
static void gxml_node_real_normalize (GXmlDomNode* base);
static gboolean gxml_node_real_is_equal_node (GXmlDomNode* base,
                                       GXmlDomNode* node);
static GXmlDomNodeDocumentPosition gxml_node_real_compare_document_position (GXmlDomNode* base,
                                                                      GXmlDomNode* other);
static gboolean gxml_node_real_contains (GXmlDomNode* base,
                                  GXmlDomNode* other);
static gchar* gxml_node_real_lookup_prefix (GXmlDomNode* base,
                                     const gchar* nspace);
static gchar* gxml_node_real_lookup_namespace_uri (GXmlDomNode* base,
                                            const gchar* prefix);
static gboolean gxml_node_real_is_default_namespace (GXmlDomNode* base,
                                              const gchar* nspace);
VALA_EXTERN void gxml_node_set_parent (GXmlNode* self,
                           GXmlDomNode* node,
                           GError** error);
static GXmlDomNode* gxml_node_real_insert_before (GXmlDomNode* base,
                                           GXmlDomNode* node,
                                           GXmlDomNode* child,
                                           GError** error);
static GXmlDomNode* gxml_node_real_append_child (GXmlDomNode* base,
                                          GXmlDomNode* node,
                                          GError** error);
static GXmlDomNode* gxml_node_real_replace_child (GXmlDomNode* base,
                                           GXmlDomNode* node,
                                           GXmlDomNode* child,
                                           GError** error);
static GXmlDomNode* gxml_node_real_remove_child (GXmlDomNode* base,
                                          GXmlDomNode* child,
                                          GError** error);
static void gxml_node_real_add_event_listener (GXmlDomEventTarget* base,
                                        const gchar* type,
                                        GXmlDomEventListener* callback,
                                        gboolean capture);
static void gxml_node_real_remove_event_listener (GXmlDomEventTarget* base,
                                           const gchar* type,
                                           GXmlDomEventListener* callback,
                                           gboolean capture);
static gboolean gxml_node_real_dispatch_event (GXmlDomEventTarget* base,
                                        GXmlDomEvent* event,
                                        GError** error);
static GObject * gxml_node_constructor (GType type,
                                 guint n_construct_properties,
                                 GObjectConstructParam * construct_properties);
static void gxml_node_finalize (GObject * obj);
static GType gxml_node_get_type_once (void);
static void _vala_gxml_node_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec);
static void _vala_gxml_node_set_property (GObject * object,
                                   guint property_id,
                                   const GValue * value,
                                   GParamSpec * pspec);
static GXmlDomNode* gxml_node_list_real_item (GXmlDomNodeList* base,
                                       gint index);
static GType gxml_node_list_get_type_once (void);
static void _vala_gxml_node_list_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GXmlDomNodeNodeType
gxml_node_real_get_node_type (GXmlDomNode* base)
{
	GXmlDomNodeNodeType result;
	GXmlNode* self;
	self = (GXmlNode*) base;
	result = self->_node_type;
	return result;
}

static gchar*
gxml_node_real_get_node_name (GXmlDomNode* base)
{
	gchar* result;
	GXmlNode* self;
	const gchar* _tmp0_;
	gboolean _tmp2_ = FALSE;
	const gchar* _tmp3_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	self = (GXmlNode*) base;
	_tmp0_ = self->_local_name;
	if (_tmp0_ == NULL) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("NO NAME");
		result = _tmp1_;
		return result;
	}
	_tmp3_ = self->_prefix;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		const gchar* _tmp4_;
		_tmp4_ = self->_prefix;
		_tmp2_ = g_strcmp0 (_tmp4_, "") == 0;
	}
	if (_tmp2_) {
		const gchar* _tmp5_;
		gchar* _tmp6_;
		_tmp5_ = self->_local_name;
		_tmp6_ = g_strdup (_tmp5_);
		result = _tmp6_;
		return result;
	}
	_tmp7_ = self->_prefix;
	_tmp8_ = g_strconcat (_tmp7_, ":", NULL);
	_tmp9_ = _tmp8_;
	_tmp10_ = self->_local_name;
	_tmp11_ = g_strconcat (_tmp9_, _tmp10_, NULL);
	_tmp12_ = _tmp11_;
	_g_free0 (_tmp9_);
	result = _tmp12_;
	return result;
}

static const gchar*
gxml_node_real_get_base_uri (GXmlDomNode* base)
{
	const gchar* result;
	GXmlNode* self;
	const gchar* _tmp0_;
	self = (GXmlNode*) base;
	_tmp0_ = self->_base_uri;
	result = _tmp0_;
	return result;
}

static GXmlDomDocument*
gxml_node_real_get_owner_document (GXmlDomNode* base)
{
	GXmlDomDocument* result;
	GXmlNode* self;
	GXmlDomDocument* _tmp0_;
	GXmlDomDocument* _tmp7_;
	GError* _inner_error0_ = NULL;
	self = (GXmlNode*) base;
	if (GXML_IS_DOM_DOCUMENT (self)) {
		result = G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_DOM_DOCUMENT, GXmlDomDocument);
		return result;
	}
	_tmp0_ = self->_document;
	if (_tmp0_ == NULL) {
		GXmlDocument* _tmp1_;
		_tmp1_ = gxml_document_new ();
		_g_object_unref0 (self->_document);
		self->_document = (GXmlDomDocument*) _tmp1_;
		if (GXML_IS_DOM_ELEMENT (self)) {
			{
				GXmlDomDocument* _tmp2_;
				GXmlDomNode* _tmp3_;
				GXmlDomNode* _tmp4_;
				_tmp2_ = self->_document;
				_tmp3_ = gxml_dom_node_append_child ((GXmlDomNode*) _tmp2_, (GXmlDomNode*) self, &_inner_error0_);
				_tmp4_ = _tmp3_;
				_g_object_unref0 (_tmp4_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
			}
			goto __finally0;
			__catch0_g_error:
			{
				GError* e = NULL;
				GError* _tmp5_;
				const gchar* _tmp6_;
				e = _inner_error0_;
				_inner_error0_ = NULL;
				_tmp5_ = e;
				_tmp6_ = _tmp5_->message;
				g_warning ("Node.vala:85: %s", _tmp6_);
				_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;
			}
		}
	}
	_tmp7_ = self->_document;
	result = _tmp7_;
	return result;
}

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

static void
gxml_node_real_set_owner_document (GXmlDomNode* base,
                                   GXmlDomDocument* value)
{
	GXmlNode* self;
	GXmlDomDocument* _tmp0_;
	self = (GXmlNode*) base;
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->_document);
	self->_document = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, gxml_node_properties[GXML_NODE_OWNER_DOCUMENT_PROPERTY]);
}

static GXmlDomNode*
gxml_node_real_get_parent_node (GXmlDomNode* base)
{
	GXmlDomNode* result;
	GXmlNode* self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	self = (GXmlNode*) base;
	_tmp0_ = self->_parent;
	_tmp1_ = _g_object_ref0 (GXML_IS_DOM_NODE (_tmp0_) ? ((GXmlDomNode*) _tmp0_) : NULL);
	result = _tmp1_;
	return result;
}

static GXmlDomElement*
gxml_node_real_get_parent_element (GXmlDomNode* base)
{
	GXmlDomElement* result;
	GXmlNode* self;
	GXmlDomNode* _tmp0_;
	self = (GXmlNode*) base;
	_tmp0_ = self->_parent;
	if (GXML_IS_DOM_ELEMENT (_tmp0_)) {
		GXmlDomNode* _tmp1_;
		GXmlDomElement* _tmp2_;
		_tmp1_ = self->_parent;
		_tmp2_ = _g_object_ref0 (GXML_IS_DOM_ELEMENT (_tmp1_) ? ((GXmlDomElement*) _tmp1_) : NULL);
		result = _tmp2_;
		return result;
	}
	result = NULL;
	return result;
}

static GXmlDomNodeList*
gxml_node_real_get_child_nodes (GXmlDomNode* base)
{
	GXmlDomNodeList* result;
	GXmlNode* self;
	GXmlNodeList* _tmp0_;
	GXmlDomNodeList* _tmp1_;
	self = (GXmlNode*) base;
	_tmp0_ = self->_child_nodes;
	_tmp1_ = _g_object_ref0 (GXML_IS_DOM_NODE_LIST (_tmp0_) ? ((GXmlDomNodeList*) _tmp0_) : NULL);
	result = _tmp1_;
	return result;
}

static GXmlDomNode*
gxml_node_real_get_first_child (GXmlDomNode* base)
{
	GXmlDomNode* result;
	GXmlNode* self;
	GXmlDomNodeList* _tmp0_;
	GXmlDomNodeList* _tmp1_;
	GXmlDomNodeList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gboolean _tmp5_;
	GXmlDomNodeList* _tmp6_;
	GXmlDomNodeList* _tmp7_;
	GXmlDomNodeList* _tmp8_;
	gpointer _tmp9_;
	GXmlDomNode* _tmp10_;
	self = (GXmlNode*) base;
	_tmp0_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ == 0;
	_g_object_unref0 (_tmp2_);
	if (_tmp5_) {
		result = NULL;
		return result;
	}
	_tmp6_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	_tmp9_ = gee_list_get ((GeeList*) _tmp8_, 0);
	_tmp10_ = (GXmlDomNode*) _tmp9_;
	_g_object_unref0 (_tmp8_);
	result = _tmp10_;
	return result;
}

static GXmlDomNode*
gxml_node_real_get_last_child (GXmlDomNode* base)
{
	GXmlDomNode* result;
	GXmlNode* self;
	GXmlDomNodeList* _tmp0_;
	GXmlDomNodeList* _tmp1_;
	GXmlDomNodeList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gboolean _tmp5_;
	GXmlDomNodeList* _tmp6_;
	GXmlDomNodeList* _tmp7_;
	GXmlDomNodeList* _tmp8_;
	GXmlDomNodeList* _tmp9_;
	GXmlDomNodeList* _tmp10_;
	GXmlDomNodeList* _tmp11_;
	gint _tmp12_;
	gint _tmp13_;
	gpointer _tmp14_;
	GXmlDomNode* _tmp15_;
	self = (GXmlNode*) base;
	_tmp0_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ == 0;
	_g_object_unref0 (_tmp2_);
	if (_tmp5_) {
		result = NULL;
		return result;
	}
	_tmp6_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	_tmp9_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp10_ = _tmp9_;
	_tmp11_ = _tmp10_;
	_tmp12_ = gee_collection_get_size ((GeeCollection*) _tmp11_);
	_tmp13_ = _tmp12_;
	_tmp14_ = gee_list_get ((GeeList*) _tmp8_, _tmp13_ - 1);
	_tmp15_ = (GXmlDomNode*) _tmp14_;
	_g_object_unref0 (_tmp11_);
	_g_object_unref0 (_tmp8_);
	result = _tmp15_;
	return result;
}

static GXmlDomNode*
gxml_node_real_get_previous_sibling (GXmlDomNode* base)
{
	GXmlDomNode* result;
	GXmlNode* self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNodeList* _tmp2_;
	GXmlDomNodeList* _tmp3_;
	GXmlDomNodeList* _tmp4_;
	gboolean _tmp5_;
	GXmlDomNode* _tmp6_;
	GXmlDomNodeList* _tmp7_;
	GXmlDomNodeList* _tmp8_;
	GXmlDomNodeList* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gboolean _tmp12_;
	gint pos = 0;
	GXmlDomNode* _tmp13_;
	GXmlDomNodeList* _tmp14_;
	GXmlDomNodeList* _tmp15_;
	GeeArrayList* _tmp16_;
	gint _tmp17_;
	gboolean _tmp18_ = FALSE;
	self = (GXmlNode*) base;
	_tmp0_ = self->_parent;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->_parent;
	_tmp2_ = gxml_dom_node_get_child_nodes (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ == NULL;
	_g_object_unref0 (_tmp4_);
	if (_tmp5_) {
		result = NULL;
		return result;
	}
	_tmp6_ = self->_parent;
	_tmp7_ = gxml_dom_node_get_child_nodes (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_;
	_tmp10_ = gxml_dom_node_list_get_length (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = _tmp11_ == 0;
	_g_object_unref0 (_tmp9_);
	if (_tmp12_) {
		result = NULL;
		return result;
	}
	_tmp13_ = self->_parent;
	_tmp14_ = gxml_dom_node_get_child_nodes (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GEE_TYPE_ARRAY_LIST, GeeArrayList);
	_tmp17_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp16_, (GXmlDomNode*) self);
	_g_object_unref0 (_tmp16_);
	pos = _tmp17_;
	if (pos == 0) {
		result = NULL;
		return result;
	}
	if ((pos - 1) > 0) {
		GXmlDomNode* _tmp19_;
		GXmlDomNodeList* _tmp20_;
		GXmlDomNodeList* _tmp21_;
		GXmlDomNodeList* _tmp22_;
		gint _tmp23_;
		gint _tmp24_;
		_tmp19_ = self->_parent;
		_tmp20_ = gxml_dom_node_get_child_nodes (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = _tmp21_;
		_tmp23_ = gee_collection_get_size ((GeeCollection*) _tmp22_);
		_tmp24_ = _tmp23_;
		_tmp18_ = (pos - 1) < _tmp24_;
		_g_object_unref0 (_tmp22_);
	} else {
		_tmp18_ = FALSE;
	}
	if (_tmp18_) {
		GXmlDomNode* _tmp25_;
		GXmlDomNodeList* _tmp26_;
		GXmlDomNodeList* _tmp27_;
		GXmlDomNodeList* _tmp28_;
		gpointer _tmp29_;
		GXmlDomNode* _tmp30_;
		_tmp25_ = self->_parent;
		_tmp26_ = gxml_dom_node_get_child_nodes (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = _tmp27_;
		_tmp29_ = gee_list_get ((GeeList*) _tmp28_, pos - 1);
		_tmp30_ = (GXmlDomNode*) _tmp29_;
		_g_object_unref0 (_tmp28_);
		result = _tmp30_;
		return result;
	}
	result = NULL;
	return result;
}

static GXmlDomNode*
gxml_node_real_get_next_sibling (GXmlDomNode* base)
{
	GXmlDomNode* result;
	GXmlNode* self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNodeList* _tmp2_;
	GXmlDomNodeList* _tmp3_;
	GXmlDomNodeList* _tmp4_;
	gboolean _tmp5_;
	GXmlDomNode* _tmp6_;
	GXmlDomNodeList* _tmp7_;
	GXmlDomNodeList* _tmp8_;
	GXmlDomNodeList* _tmp9_;
	gint _tmp10_;
	gint _tmp11_;
	gboolean _tmp12_;
	gint pos = 0;
	GXmlDomNode* _tmp13_;
	GXmlDomNodeList* _tmp14_;
	GXmlDomNodeList* _tmp15_;
	GeeArrayList* _tmp16_;
	gint _tmp17_;
	gboolean _tmp18_ = FALSE;
	self = (GXmlNode*) base;
	_tmp0_ = self->_parent;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->_parent;
	_tmp2_ = gxml_dom_node_get_child_nodes (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_ == NULL;
	_g_object_unref0 (_tmp4_);
	if (_tmp5_) {
		result = NULL;
		return result;
	}
	_tmp6_ = self->_parent;
	_tmp7_ = gxml_dom_node_get_child_nodes (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_;
	_tmp10_ = gxml_dom_node_list_get_length (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = _tmp11_ == 0;
	_g_object_unref0 (_tmp9_);
	if (_tmp12_) {
		result = NULL;
		return result;
	}
	_tmp13_ = self->_parent;
	_tmp14_ = gxml_dom_node_get_child_nodes (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp15_, GEE_TYPE_ARRAY_LIST, GeeArrayList);
	_tmp17_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp16_, (GXmlDomNode*) self);
	_g_object_unref0 (_tmp16_);
	pos = _tmp17_;
	if (pos == 0) {
		result = NULL;
		return result;
	}
	if ((pos + 1) > 0) {
		GXmlDomNode* _tmp19_;
		GXmlDomNodeList* _tmp20_;
		GXmlDomNodeList* _tmp21_;
		GXmlDomNodeList* _tmp22_;
		gint _tmp23_;
		gint _tmp24_;
		_tmp19_ = self->_parent;
		_tmp20_ = gxml_dom_node_get_child_nodes (_tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = _tmp21_;
		_tmp23_ = gee_collection_get_size ((GeeCollection*) _tmp22_);
		_tmp24_ = _tmp23_;
		_tmp18_ = (pos + 1) < _tmp24_;
		_g_object_unref0 (_tmp22_);
	} else {
		_tmp18_ = FALSE;
	}
	if (_tmp18_) {
		GXmlDomNode* _tmp25_;
		GXmlDomNodeList* _tmp26_;
		GXmlDomNodeList* _tmp27_;
		GXmlDomNodeList* _tmp28_;
		gpointer _tmp29_;
		GXmlDomNode* _tmp30_;
		_tmp25_ = self->_parent;
		_tmp26_ = gxml_dom_node_get_child_nodes (_tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = _tmp27_;
		_tmp29_ = gee_list_get ((GeeList*) _tmp28_, pos + 1);
		_tmp30_ = (GXmlDomNode*) _tmp29_;
		_g_object_unref0 (_tmp28_);
		result = _tmp30_;
		return result;
	}
	result = NULL;
	return result;
}

static gchar*
gxml_node_real_get_node_value (GXmlDomNode* base)
{
	gchar* result;
	GXmlNode* self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlNode*) base;
	_tmp0_ = self->_node_value;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
gxml_node_real_set_node_value (GXmlDomNode* base,
                               const gchar* value)
{
	GXmlNode* self;
	gchar* _tmp0_;
	self = (GXmlNode*) base;
	_tmp0_ = g_strdup (value);
	_g_free0 (self->_node_value);
	self->_node_value = _tmp0_;
	g_object_notify_by_pspec ((GObject *) self, gxml_node_properties[GXML_NODE_NODE_VALUE_PROPERTY]);
}

static gchar*
gxml_node_real_get_text_content (GXmlDomNode* base)
{
	gchar* result;
	GXmlNode* self;
	gchar* t = NULL;
	self = (GXmlNode*) base;
	t = 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_DOM_TEXT (_tmp9_)) {
				const gchar* _tmp10_;
				_tmp10_ = t;
				if (_tmp10_ == NULL) {
					GXmlDomNode* _tmp11_;
					gchar* _tmp12_;
					gchar* _tmp13_;
					_tmp11_ = n;
					_tmp12_ = gxml_dom_node_get_node_value (_tmp11_);
					_tmp13_ = _tmp12_;
					_g_free0 (t);
					t = _tmp13_;
				} else {
					const gchar* _tmp14_;
					GXmlDomNode* _tmp15_;
					gchar* _tmp16_;
					gchar* _tmp17_;
					gchar* _tmp18_;
					gchar* _tmp19_;
					_tmp14_ = t;
					_tmp15_ = n;
					_tmp16_ = gxml_dom_node_get_node_value (_tmp15_);
					_tmp17_ = _tmp16_;
					_tmp18_ = _tmp17_;
					_tmp19_ = g_strconcat (_tmp14_, _tmp18_, NULL);
					_g_free0 (t);
					t = _tmp19_;
					_g_free0 (_tmp18_);
				}
			}
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
	result = t;
	return result;
}

static void
gxml_node_real_set_text_content (GXmlDomNode* base,
                                 const gchar* value)
{
	GXmlNode* self;
	GError* _inner_error0_ = NULL;
	self = (GXmlNode*) base;
	{
		GXmlDomText* t = NULL;
		GXmlDomDocument* _tmp0_;
		GXmlDomText* _tmp1_;
		GXmlDomNodeList* _tmp2_;
		GXmlDomNodeList* _tmp3_;
		GXmlDomNodeList* _tmp4_;
		_tmp0_ = self->_document;
		_tmp1_ = gxml_dom_document_create_text_node (_tmp0_, value, &_inner_error0_);
		t = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		gee_collection_add ((GeeCollection*) _tmp4_, (GXmlDomNode*) t);
		_g_object_unref0 (_tmp4_);
		_g_object_unref0 (t);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		g_warning ("Node.vala:156: %s", _ ("Text content in element can't be created"));
	}
	__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;
	}
	g_object_notify_by_pspec ((GObject *) self, gxml_node_properties[GXML_NODE_TEXT_CONTENT_PROPERTY]);
}

static gboolean
gxml_node_real_has_child_nodes (GXmlDomNode* base)
{
	GXmlNode * self;
	GXmlNodeList* _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gboolean result;
	self = (GXmlNode*) base;
	_tmp0_ = self->_child_nodes;
	_tmp1_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_ > 0;
	return result;
}

static void
gxml_node_real_normalize (GXmlDomNode* base)
{
	GXmlNode * self;
	self = (GXmlNode*) base;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GXmlDomNodeList* _tmp2_;
				GXmlDomNodeList* _tmp3_;
				GXmlDomNodeList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gboolean _tmp7_;
				GXmlDomNode* n = NULL;
				GXmlDomNodeList* _tmp8_;
				GXmlDomNodeList* _tmp9_;
				GXmlDomNodeList* _tmp10_;
				gpointer _tmp11_;
				GXmlDomNode* _tmp12_;
				GXmlDomNode* _tmp13_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
				_tmp3_ = _tmp2_;
				_tmp4_ = _tmp3_;
				_tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_tmp7_ = !(i < _tmp6_);
				_g_object_unref0 (_tmp4_);
				if (_tmp7_) {
					break;
				}
				_tmp8_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
				_tmp9_ = _tmp8_;
				_tmp10_ = _tmp9_;
				_tmp11_ = gee_list_get ((GeeList*) _tmp10_, i);
				_tmp12_ = (GXmlDomNode*) _tmp11_;
				_g_object_unref0 (_tmp10_);
				n = _tmp12_;
				_tmp13_ = n;
				if (GXML_IS_DOM_TEXT (_tmp13_)) {
					GXmlDomNodeList* _tmp14_;
					GXmlDomNodeList* _tmp15_;
					GXmlDomNodeList* _tmp16_;
					gpointer _tmp17_;
					GXmlDomNode* _tmp18_;
					_tmp14_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
					_tmp15_ = _tmp14_;
					_tmp16_ = _tmp15_;
					_tmp17_ = gee_list_remove_at ((GeeList*) _tmp16_, i);
					_tmp18_ = (GXmlDomNode*) _tmp17_;
					_g_object_unref0 (_tmp18_);
					_g_object_unref0 (_tmp16_);
				}
				_g_object_unref0 (n);
			}
		}
	}
}

static gboolean
gxml_node_real_is_equal_node (GXmlDomNode* base,
                              GXmlDomNode* node)
{
	GXmlNode * self;
	gboolean result;
	self = (GXmlNode*) base;
	if (node == NULL) {
		result = FALSE;
		return result;
	}
	if (GXML_IS_DOM_CHARACTER_DATA (self)) {
		gchar* _tmp0_;
		gchar* _tmp1_;
		gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		gboolean _tmp6_;
		_tmp0_ = gxml_dom_character_data_get_data ((GXmlDomCharacterData*) G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_DOM_COMMENT, GXmlDomComment));
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gxml_dom_character_data_get_data ((GXmlDomCharacterData*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_DOM_COMMENT, GXmlDomComment));
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		_tmp6_ = g_strcmp0 (_tmp2_, _tmp5_) == 0;
		_g_free0 (_tmp5_);
		_g_free0 (_tmp2_);
		result = _tmp6_;
		return result;
	}
	result = FALSE;
	return result;
}

static GXmlDomNodeDocumentPosition
gxml_node_real_compare_document_position (GXmlDomNode* base,
                                          GXmlDomNode* other)
{
	GXmlNode * self;
	gboolean _tmp0_ = FALSE;
	GXmlDomDocument* _tmp1_;
	GXmlDomDocument* _tmp2_;
	GXmlDomDocument* _tmp3_;
	GXmlDomDocument* _tmp4_;
	GXmlDomNode* _tmp8_;
	GXmlDomNode* _tmp9_;
	GXmlDomNode* _tmp10_;
	gboolean _tmp11_;
	GXmlDomNodeDocumentPosition result;
	self = (GXmlNode*) base;
	g_return_val_if_fail (other != NULL, 0U);
	if ((GXML_IS_DOM_NODE (self) ? ((GXmlDomNode*) self) : NULL) == other) {
		result = GXML_DOM_NODE_DOCUMENT_POSITION_NONE;
		return result;
	}
	_tmp1_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = gxml_dom_node_get_owner_document (other);
	_tmp4_ = _tmp3_;
	if (_tmp2_ != _tmp4_) {
		_tmp0_ = TRUE;
	} else {
		GXmlDomNode* _tmp5_;
		GXmlDomNode* _tmp6_;
		GXmlDomNode* _tmp7_;
		_tmp5_ = gxml_dom_node_get_parent_node (other);
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp0_ = _tmp7_ == NULL;
		_g_object_unref0 (_tmp7_);
	}
	if (_tmp0_) {
		GXmlDomNodeDocumentPosition p = 0U;
		p = GXML_DOM_NODE_DOCUMENT_POSITION_DISCONNECTED & GXML_DOM_NODE_DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC;
		if ((&self) > (&other)) {
			p = p & GXML_DOM_NODE_DOCUMENT_POSITION_PRECEDING;
		} else {
			p = p & GXML_DOM_NODE_DOCUMENT_POSITION_FOLLOWING;
		}
		result = p;
		return result;
	}
	if (gxml_dom_node_contains (G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_DOM_NODE, GXmlDomNode), other)) {
		result = GXML_DOM_NODE_DOCUMENT_POSITION_CONTAINED_BY & GXML_DOM_NODE_DOCUMENT_POSITION_FOLLOWING;
		return result;
	}
	_tmp8_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp9_ = _tmp8_;
	_tmp10_ = _tmp9_;
	_tmp11_ = gxml_dom_node_contains (_tmp10_, other);
	_g_object_unref0 (_tmp10_);
	if (_tmp11_) {
		GXmlDomNode* par = NULL;
		GXmlDomNode* _tmp12_;
		GXmlDomNode* _tmp13_;
		GXmlDomNode* _tmp14_;
		GXmlDomNodeList* _tmp15_;
		GXmlDomNodeList* _tmp16_;
		GXmlDomNodeList* _tmp17_;
		GXmlDomNode* _tmp18_;
		GXmlDomNodeList* _tmp19_;
		GXmlDomNodeList* _tmp20_;
		GXmlDomNodeList* _tmp21_;
		gboolean _tmp22_;
		_tmp12_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
		_tmp13_ = _tmp12_;
		par = _tmp13_;
		_tmp14_ = par;
		_tmp15_ = gxml_dom_node_get_child_nodes (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp17_ = _tmp16_;
		_tmp18_ = par;
		_tmp19_ = gxml_dom_node_get_child_nodes (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = _tmp20_;
		_tmp22_ = gee_list_index_of ((GeeList*) _tmp17_, (GXmlDomNode*) self) > gee_list_index_of ((GeeList*) _tmp21_, other);
		_g_object_unref0 (_tmp21_);
		_g_object_unref0 (_tmp17_);
		if (_tmp22_) {
			result = GXML_DOM_NODE_DOCUMENT_POSITION_PRECEDING;
			_g_object_unref0 (par);
			return result;
		} else {
			result = GXML_DOM_NODE_DOCUMENT_POSITION_FOLLOWING;
			_g_object_unref0 (par);
			return result;
		}
		_g_object_unref0 (par);
	}
	if (gxml_dom_node_contains (other, (GXmlDomNode*) self)) {
		result = GXML_DOM_NODE_DOCUMENT_POSITION_CONTAINS & GXML_DOM_NODE_DOCUMENT_POSITION_PRECEDING;
		return result;
	}
	g_warning ("Node.vala:209: %s", _ ("Can't find node position"));
	result = GXML_DOM_NODE_DOCUMENT_POSITION_NONE;
	return result;
}

static gboolean
gxml_node_real_contains (GXmlDomNode* base,
                         GXmlDomNode* other)
{
	GXmlNode * self;
	GXmlDomNodeList* _tmp0_;
	GXmlDomNodeList* _tmp1_;
	GXmlDomNodeList* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	self = (GXmlNode*) base;
	if (other == NULL) {
		result = FALSE;
		return result;
	}
	_tmp0_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_collection_contains ((GeeCollection*) _tmp2_, other);
	_g_object_unref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

static gchar*
gxml_node_real_lookup_prefix (GXmlDomNode* base,
                              const gchar* nspace)
{
	GXmlNode * self;
	gboolean _tmp0_ = FALSE;
	gchar* result;
	self = (GXmlNode*) base;
	if (GXML_IS_DOM_DOCUMENT_TYPE (self)) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = GXML_IS_DOM_DOCUMENT_FRAGMENT (self);
	}
	if (_tmp0_) {
		result = NULL;
		return result;
	}
	if (GXML_IS_DOM_ELEMENT (self)) {
		gchar* _tmp1_;
		_tmp1_ = gxml_element_lookup_prefix (G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_ELEMENT, GXmlElement), nspace);
		result = _tmp1_;
		return result;
	}
	if (GXML_IS_ATTR (self)) {
		GXmlDomNode* _tmp2_;
		GXmlDomNode* _tmp3_;
		GXmlDomNode* _tmp4_;
		gboolean _tmp5_;
		GXmlDomNode* _tmp6_;
		GXmlDomNode* _tmp7_;
		GXmlDomNode* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp2_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_ == NULL;
		_g_object_unref0 (_tmp4_);
		if (_tmp5_) {
			result = NULL;
			return result;
		}
		_tmp6_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
		_tmp7_ = _tmp6_;
		_tmp8_ = _tmp7_;
		_tmp9_ = gxml_dom_node_lookup_prefix (_tmp8_, nspace);
		_tmp10_ = _tmp9_;
		_g_object_unref0 (_tmp8_);
		result = _tmp10_;
		return result;
	}
	result = NULL;
	return result;
}

static gchar*
gxml_node_real_lookup_namespace_uri (GXmlDomNode* base,
                                     const gchar* prefix)
{
	GXmlNode * self;
	gboolean _tmp0_ = FALSE;
	gchar* result;
	self = (GXmlNode*) base;
	if (GXML_IS_DOM_DOCUMENT_TYPE (self)) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = GXML_IS_DOM_DOCUMENT_FRAGMENT (self);
	}
	if (_tmp0_) {
		result = NULL;
		return result;
	}
	if (GXML_IS_DOM_ELEMENT (self)) {
		gchar* _tmp1_;
		_tmp1_ = gxml_element_lookup_namespace_uri (G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_ELEMENT, GXmlElement), prefix);
		result = _tmp1_;
		return result;
	}
	if (GXML_IS_ATTR (self)) {
		GXmlDomNode* _tmp2_;
		GXmlDomNode* _tmp3_;
		GXmlDomNode* _tmp4_;
		gboolean _tmp5_;
		GXmlDomNode* _tmp6_;
		GXmlDomNode* _tmp7_;
		GXmlDomNode* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp2_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_ == NULL;
		_g_object_unref0 (_tmp4_);
		if (_tmp5_) {
			result = NULL;
			return result;
		}
		_tmp6_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
		_tmp7_ = _tmp6_;
		_tmp8_ = _tmp7_;
		_tmp9_ = gxml_dom_node_lookup_namespace_uri (_tmp8_, prefix);
		_tmp10_ = _tmp9_;
		_g_object_unref0 (_tmp8_);
		result = _tmp10_;
		return result;
	}
	result = NULL;
	return result;
}

static gboolean
gxml_node_real_is_default_namespace (GXmlDomNode* base,
                                     const gchar* nspace)
{
	GXmlNode * self;
	gchar* ns = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	gboolean result;
	self = (GXmlNode*) base;
	_tmp0_ = gxml_dom_node_lookup_namespace_uri ((GXmlDomNode*) self, NULL);
	ns = _tmp0_;
	_tmp1_ = ns;
	if (g_strcmp0 (_tmp1_, nspace) == 0) {
		result = TRUE;
		_g_free0 (ns);
		return result;
	}
	result = FALSE;
	_g_free0 (ns);
	return result;
}

/**
   * Sets node's parent and checks for namespace conflics.
   */
void
gxml_node_set_parent (GXmlNode* self,
                      GXmlDomNode* node,
                      GError** error)
{
	GXmlDomDocument* _tmp0_;
	GXmlDomDocument* _tmp1_;
	GXmlDomDocument* _tmp2_;
	GXmlDomNode* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (node != NULL);
	_tmp0_ = gxml_dom_node_get_owner_document (node);
	_tmp1_ = _tmp0_;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->_document);
	self->_document = _tmp2_;
	_tmp3_ = _g_object_ref0 (node);
	_g_object_unref0 (self->_parent);
	self->_parent = _tmp3_;
}

static GXmlDomNode*
gxml_node_real_insert_before (GXmlDomNode* base,
                              GXmlDomNode* node,
                              GXmlDomNode* child,
                              GError** error)
{
	GXmlNode * self;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean _tmp10_ = FALSE;
	GXmlDomNodeList* _tmp20_;
	GXmlDomNodeList* _tmp21_;
	GXmlDomNodeList* _tmp22_;
	GXmlDomNode* _tmp23_;
	GError* _inner_error0_ = NULL;
	GXmlDomNode* result;
	self = (GXmlNode*) base;
	g_return_val_if_fail (node != NULL, NULL);
	if (!GXML_IS_NODE (node)) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Invalid attempt to add invalid node type"));
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (child != NULL) {
		_tmp1_ = !gxml_dom_node_contains ((GXmlDomNode*) self, child);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GError* _tmp2_;
		_tmp2_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NOT_FOUND_ERROR, _ ("Can't find child to insert node before"));
		_inner_error0_ = _tmp2_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (GXML_IS_DOM_DOCUMENT (self)) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = GXML_IS_DOM_ELEMENT (self);
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = GXML_IS_DOM_DOCUMENT_FRAGMENT (self);
	}
	if (!_tmp3_) {
		GError* _tmp5_;
		_tmp5_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Invalid attempt to insert a node"));
		_inner_error0_ = _tmp5_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (GXML_IS_DOM_DOCUMENT_FRAGMENT (node)) {
		_tmp10_ = TRUE;
	} else {
		_tmp10_ = GXML_IS_DOM_DOCUMENT_TYPE (node);
	}
	if (_tmp10_) {
		_tmp9_ = TRUE;
	} else {
		_tmp9_ = GXML_IS_DOM_ELEMENT (node);
	}
	if (_tmp9_) {
		_tmp8_ = TRUE;
	} else {
		_tmp8_ = GXML_IS_DOM_TEXT (node);
	}
	if (_tmp8_) {
		_tmp7_ = TRUE;
	} else {
		_tmp7_ = GXML_IS_DOM_PROCESSING_INSTRUCTION (node);
	}
	if (_tmp7_) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = GXML_IS_DOM_COMMENT (node);
	}
	if (!_tmp6_) {
		GError* _tmp11_;
		_tmp11_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Invalid attempt to insert an invalid node type"));
		_inner_error0_ = _tmp11_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (child != NULL) {
		gint i = 0;
		GXmlDomNodeList* _tmp12_;
		GXmlDomNodeList* _tmp13_;
		GXmlDomNodeList* _tmp14_;
		gint _tmp15_;
		GXmlDomNodeList* _tmp16_;
		GXmlDomNodeList* _tmp17_;
		GXmlDomNodeList* _tmp18_;
		GXmlDomNode* _tmp19_;
		_tmp12_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp13_ = _tmp12_;
		_tmp14_ = _tmp13_;
		_tmp15_ = gee_list_index_of ((GeeList*) _tmp14_, GXML_IS_DOM_NODE (child) ? ((GXmlDomNode*) child) : NULL);
		_g_object_unref0 (_tmp14_);
		i = _tmp15_;
		_tmp16_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp17_ = _tmp16_;
		_tmp18_ = _tmp17_;
		gee_list_insert ((GeeList*) _tmp18_, i, GXML_IS_DOM_NODE (node) ? ((GXmlDomNode*) node) : NULL);
		_g_object_unref0 (_tmp18_);
		_tmp19_ = _g_object_ref0 (node);
		result = _tmp19_;
		return result;
	}
	_tmp20_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp21_ = _tmp20_;
	_tmp22_ = _tmp21_;
	gee_collection_add ((GeeCollection*) _tmp22_, GXML_IS_DOM_NODE (node) ? ((GXmlDomNode*) node) : NULL);
	_g_object_unref0 (_tmp22_);
	_tmp23_ = _g_object_ref0 (node);
	result = _tmp23_;
	return result;
}

static GXmlDomNode*
gxml_node_real_append_child (GXmlDomNode* base,
                             GXmlDomNode* node,
                             GError** error)
{
	GXmlNode * self;
	GXmlDomDocument* _tmp1_;
	GXmlDomDocument* _tmp2_;
	GXmlDomDocument* _tmp3_;
	GXmlDomDocument* _tmp4_;
	GXmlDomNode* _tmp6_ = NULL;
	GXmlDomNode* _tmp7_;
	GXmlDomNode* _tmp8_;
	GError* _inner_error0_ = NULL;
	GXmlDomNode* result;
	self = (GXmlNode*) base;
	g_return_val_if_fail (node != NULL, NULL);
	if (!GXML_IS_NODE (node)) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Node type is invalid. Can't append as child"));
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp1_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = gxml_dom_node_get_owner_document (node);
	_tmp4_ = _tmp3_;
	if (_tmp2_ != _tmp4_) {
		GError* _tmp5_;
		_tmp5_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Invalid attempt to append a child with different parent document"));
		_inner_error0_ = _tmp5_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	gxml_node_set_parent (G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_NODE, GXmlNode), (GXmlDomNode*) self, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp7_ = gxml_dom_node_insert_before ((GXmlDomNode*) self, node, NULL, &_inner_error0_);
	_tmp6_ = _tmp7_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp8_ = _tmp6_;
	_tmp6_ = NULL;
	result = _tmp8_;
	_g_object_unref0 (_tmp6_);
	return result;
}

static GXmlDomNode*
gxml_node_real_replace_child (GXmlDomNode* base,
                              GXmlDomNode* node,
                              GXmlDomNode* child,
                              GError** error)
{
	GXmlNode * self;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp6_ = FALSE;
	gboolean _tmp7_ = FALSE;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	gboolean _tmp10_ = FALSE;
	gboolean _tmp12_ = FALSE;
	gboolean _tmp13_ = FALSE;
	gint i = 0;
	GXmlDomNodeList* _tmp16_;
	GXmlDomNodeList* _tmp17_;
	GXmlDomNodeList* _tmp18_;
	gint _tmp19_;
	GXmlDomNodeList* _tmp20_;
	GXmlDomNodeList* _tmp21_;
	GXmlDomNodeList* _tmp22_;
	gpointer _tmp23_;
	GXmlDomNode* _tmp24_;
	GXmlDomNodeList* _tmp25_;
	GXmlDomNodeList* _tmp26_;
	GXmlDomNodeList* _tmp27_;
	gint _tmp28_;
	gint _tmp29_;
	gboolean _tmp30_;
	GXmlDomNodeList* _tmp34_;
	GXmlDomNodeList* _tmp35_;
	GXmlDomNodeList* _tmp36_;
	gint _tmp37_;
	gint _tmp38_;
	gboolean _tmp39_;
	GXmlDomNode* _tmp43_;
	GError* _inner_error0_ = NULL;
	GXmlDomNode* result;
	self = (GXmlNode*) base;
	g_return_val_if_fail (node != NULL, NULL);
	g_return_val_if_fail (child != NULL, NULL);
	if (!GXML_IS_NODE (node)) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_INVALID_NODE_TYPE_ERROR, _ ("Invalid attempt to add invalid node type"));
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (child == NULL) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = !gxml_dom_node_contains ((GXmlDomNode*) self, child);
	}
	if (_tmp1_) {
		GError* _tmp2_;
		_tmp2_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NOT_FOUND_ERROR, _ ("Can't find child node to replace or child have a different parent"));
		_inner_error0_ = _tmp2_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (GXML_IS_DOM_DOCUMENT (self)) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = GXML_IS_DOM_ELEMENT (self);
	}
	if (_tmp4_) {
		_tmp3_ = TRUE;
	} else {
		_tmp3_ = GXML_IS_DOM_DOCUMENT_FRAGMENT (self);
	}
	if (!_tmp3_) {
		GError* _tmp5_;
		_tmp5_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Invalid attempt to insert a node"));
		_inner_error0_ = _tmp5_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (GXML_IS_DOM_DOCUMENT_FRAGMENT (node)) {
		_tmp10_ = TRUE;
	} else {
		_tmp10_ = GXML_IS_DOM_DOCUMENT_TYPE (node);
	}
	if (_tmp10_) {
		_tmp9_ = TRUE;
	} else {
		_tmp9_ = GXML_IS_DOM_ELEMENT (node);
	}
	if (_tmp9_) {
		_tmp8_ = TRUE;
	} else {
		_tmp8_ = GXML_IS_DOM_TEXT (node);
	}
	if (_tmp8_) {
		_tmp7_ = TRUE;
	} else {
		_tmp7_ = GXML_IS_DOM_PROCESSING_INSTRUCTION (node);
	}
	if (_tmp7_) {
		_tmp6_ = TRUE;
	} else {
		_tmp6_ = GXML_IS_DOM_COMMENT (node);
	}
	if (!_tmp6_) {
		GError* _tmp11_;
		_tmp11_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Invalid attempt to insert an invalid node type"));
		_inner_error0_ = _tmp11_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (GXML_IS_DOM_TEXT (node)) {
		_tmp13_ = GXML_IS_DOM_DOCUMENT (self);
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		_tmp12_ = TRUE;
	} else {
		gboolean _tmp14_ = FALSE;
		if (GXML_IS_DOM_DOCUMENT_TYPE (node)) {
			_tmp14_ = !GXML_IS_DOM_DOCUMENT (self);
		} else {
			_tmp14_ = FALSE;
		}
		_tmp12_ = _tmp14_;
	}
	if (_tmp12_) {
		GError* _tmp15_;
		_tmp15_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Invalid attempt to insert a document's type or text node to an invalid" \
" parent"));
		_inner_error0_ = _tmp15_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp16_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp17_ = _tmp16_;
	_tmp18_ = _tmp17_;
	_tmp19_ = gee_list_index_of ((GeeList*) _tmp18_, GXML_IS_DOM_NODE (child) ? ((GXmlDomNode*) child) : NULL);
	_g_object_unref0 (_tmp18_);
	i = _tmp19_;
	_tmp20_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp21_ = _tmp20_;
	_tmp22_ = _tmp21_;
	_tmp23_ = gee_list_remove_at ((GeeList*) _tmp22_, i);
	_tmp24_ = (GXmlDomNode*) _tmp23_;
	_g_object_unref0 (_tmp24_);
	_g_object_unref0 (_tmp22_);
	_tmp25_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp26_ = _tmp25_;
	_tmp27_ = _tmp26_;
	_tmp28_ = gee_collection_get_size ((GeeCollection*) _tmp27_);
	_tmp29_ = _tmp28_;
	_tmp30_ = i < _tmp29_;
	_g_object_unref0 (_tmp27_);
	if (_tmp30_) {
		GXmlDomNodeList* _tmp31_;
		GXmlDomNodeList* _tmp32_;
		GXmlDomNodeList* _tmp33_;
		_tmp31_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp32_ = _tmp31_;
		_tmp33_ = _tmp32_;
		gee_list_insert ((GeeList*) _tmp33_, i, GXML_IS_DOM_NODE (node) ? ((GXmlDomNode*) node) : NULL);
		_g_object_unref0 (_tmp33_);
	}
	_tmp34_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp35_ = _tmp34_;
	_tmp36_ = _tmp35_;
	_tmp37_ = gee_collection_get_size ((GeeCollection*) _tmp36_);
	_tmp38_ = _tmp37_;
	_tmp39_ = i >= _tmp38_;
	_g_object_unref0 (_tmp36_);
	if (_tmp39_) {
		GXmlDomNodeList* _tmp40_;
		GXmlDomNodeList* _tmp41_;
		GXmlDomNodeList* _tmp42_;
		_tmp40_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp41_ = _tmp40_;
		_tmp42_ = _tmp41_;
		gee_collection_add ((GeeCollection*) _tmp42_, node);
		_g_object_unref0 (_tmp42_);
	}
	_tmp43_ = _g_object_ref0 (child);
	result = _tmp43_;
	return result;
}

static GXmlDomNode*
gxml_node_real_remove_child (GXmlDomNode* base,
                             GXmlDomNode* child,
                             GError** error)
{
	GXmlNode * self;
	gint i = 0;
	GXmlDomNodeList* _tmp1_;
	GXmlDomNodeList* _tmp2_;
	GXmlDomNodeList* _tmp3_;
	gint _tmp4_;
	GXmlDomNodeList* _tmp5_;
	GXmlDomNodeList* _tmp6_;
	GXmlDomNodeList* _tmp7_;
	gpointer _tmp8_;
	GXmlDomNode* _tmp9_;
	GError* _inner_error0_ = NULL;
	GXmlDomNode* result;
	self = (GXmlNode*) base;
	g_return_val_if_fail (child != NULL, NULL);
	if (!gxml_dom_node_contains ((GXmlDomNode*) self, child)) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NOT_FOUND_ERROR, _ ("Can't find child node to remove or child have a different parent"));
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp1_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = gee_list_index_of ((GeeList*) _tmp3_, GXML_IS_DOM_NODE (child) ? ((GXmlDomNode*) child) : NULL);
	_g_object_unref0 (_tmp3_);
	i = _tmp4_;
	_tmp5_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp6_;
	_tmp8_ = gee_list_remove_at ((GeeList*) _tmp7_, i);
	_tmp9_ = G_TYPE_CHECK_INSTANCE_CAST ((GXmlDomNode*) _tmp8_, GXML_TYPE_DOM_NODE, GXmlDomNode);
	_g_object_unref0 (_tmp7_);
	result = _tmp9_;
	return result;
}

static void
gxml_node_real_add_event_listener (GXmlDomEventTarget* base,
                                   const gchar* type,
                                   GXmlDomEventListener* callback,
                                   gboolean capture)
{
	GXmlNode * self;
	self = (GXmlNode*) base;
	g_return_if_fail (type != NULL);
	return;
}

static void
gxml_node_real_remove_event_listener (GXmlDomEventTarget* base,
                                      const gchar* type,
                                      GXmlDomEventListener* callback,
                                      gboolean capture)
{
	GXmlNode * self;
	self = (GXmlNode*) base;
	g_return_if_fail (type != NULL);
	return;
}

static gboolean
gxml_node_real_dispatch_event (GXmlDomEventTarget* base,
                               GXmlDomEvent* event,
                               GError** error)
{
	GXmlNode * self;
	gboolean result;
	self = (GXmlNode*) base;
	g_return_val_if_fail (event != NULL, FALSE);
	result = FALSE;
	return result;
}

GXmlNode*
gxml_node_construct (GType object_type)
{
	GXmlNode * self = NULL;
	self = (GXmlNode*) g_object_new (object_type, NULL);
	return self;
}

GXmlNode*
gxml_node_new (void)
{
	return gxml_node_construct (GXML_TYPE_NODE);
}

static GObject *
gxml_node_constructor (GType type,
                       guint n_construct_properties,
                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GXmlNode * self;
	gchar* _tmp0_;
	GXmlNodeList* _tmp1_;
	parent_class = G_OBJECT_CLASS (gxml_node_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_NODE, GXmlNode);
	_tmp0_ = g_strdup ("");
	_g_free0 (self->_local_name);
	self->_local_name = _tmp0_;
	_g_free0 (self->_prefix);
	self->_prefix = NULL;
	self->_node_type = GXML_DOM_NODE_NODE_TYPE_INVALID;
	_g_free0 (self->_base_uri);
	self->_base_uri = NULL;
	_g_free0 (self->_node_value);
	self->_node_value = NULL;
	_tmp1_ = gxml_node_list_new ();
	_g_object_unref0 (self->_child_nodes);
	self->_child_nodes = _tmp1_;
	_g_object_unref0 (self->_parent);
	self->_parent = NULL;
	return obj;
}

static void
gxml_node_class_init (GXmlNodeClass * klass,
                      gpointer klass_data)
{
	gxml_node_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_node_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gxml_node_set_property;
	G_OBJECT_CLASS (klass)->constructor = gxml_node_constructor;
	G_OBJECT_CLASS (klass)->finalize = gxml_node_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_NODE_TYPE_PROPERTY, gxml_node_properties[GXML_NODE_NODE_TYPE_PROPERTY] = g_param_spec_enum ("node-type", "node-type", "node-type", GXML_DOM_NODE_TYPE_NODE_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_NODE_NAME_PROPERTY, gxml_node_properties[GXML_NODE_NODE_NAME_PROPERTY] = g_param_spec_string ("node-name", "node-name", "node-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_BASE_URI_PROPERTY, gxml_node_properties[GXML_NODE_BASE_URI_PROPERTY] = g_param_spec_string ("base-uri", "base-uri", "base-uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_OWNER_DOCUMENT_PROPERTY, gxml_node_properties[GXML_NODE_OWNER_DOCUMENT_PROPERTY] = g_param_spec_object ("owner-document", "owner-document", "owner-document", GXML_TYPE_DOM_DOCUMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_PARENT_NODE_PROPERTY, gxml_node_properties[GXML_NODE_PARENT_NODE_PROPERTY] = g_param_spec_object ("parent-node", "parent-node", "parent-node", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_PARENT_ELEMENT_PROPERTY, gxml_node_properties[GXML_NODE_PARENT_ELEMENT_PROPERTY] = g_param_spec_object ("parent-element", "parent-element", "parent-element", GXML_TYPE_DOM_ELEMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_CHILD_NODES_PROPERTY, gxml_node_properties[GXML_NODE_CHILD_NODES_PROPERTY] = g_param_spec_object ("child-nodes", "child-nodes", "child-nodes", GXML_TYPE_DOM_NODE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_FIRST_CHILD_PROPERTY, gxml_node_properties[GXML_NODE_FIRST_CHILD_PROPERTY] = g_param_spec_object ("first-child", "first-child", "first-child", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_LAST_CHILD_PROPERTY, gxml_node_properties[GXML_NODE_LAST_CHILD_PROPERTY] = g_param_spec_object ("last-child", "last-child", "last-child", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_PREVIOUS_SIBLING_PROPERTY, gxml_node_properties[GXML_NODE_PREVIOUS_SIBLING_PROPERTY] = g_param_spec_object ("previous-sibling", "previous-sibling", "previous-sibling", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_NEXT_SIBLING_PROPERTY, gxml_node_properties[GXML_NODE_NEXT_SIBLING_PROPERTY] = g_param_spec_object ("next-sibling", "next-sibling", "next-sibling", GXML_TYPE_DOM_NODE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_NODE_VALUE_PROPERTY, gxml_node_properties[GXML_NODE_NODE_VALUE_PROPERTY] = g_param_spec_string ("node-value", "node-value", "node-value", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_TEXT_CONTENT_PROPERTY, gxml_node_properties[GXML_NODE_TEXT_CONTENT_PROPERTY] = g_param_spec_string ("text-content", "text-content", "text-content", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
gxml_node_gxml_dom_event_target_interface_init (GXmlDomEventTargetIface * iface,
                                                gpointer iface_data)
{
	gxml_node_gxml_dom_event_target_parent_iface = g_type_interface_peek_parent (iface);
	iface->add_event_listener = (void (*) (GXmlDomEventTarget*, const gchar*, GXmlDomEventListener*, gboolean)) gxml_node_real_add_event_listener;
	iface->remove_event_listener = (void (*) (GXmlDomEventTarget*, const gchar*, GXmlDomEventListener*, gboolean)) gxml_node_real_remove_event_listener;
	iface->dispatch_event = (gboolean (*) (GXmlDomEventTarget*, GXmlDomEvent*, GError**)) gxml_node_real_dispatch_event;
}

static void
gxml_node_gxml_dom_node_interface_init (GXmlDomNodeIface * iface,
                                        gpointer iface_data)
{
	gxml_node_gxml_dom_node_parent_iface = g_type_interface_peek_parent (iface);
	iface->has_child_nodes = (gboolean (*) (GXmlDomNode*)) gxml_node_real_has_child_nodes;
	iface->normalize = (void (*) (GXmlDomNode*)) gxml_node_real_normalize;
	iface->is_equal_node = (gboolean (*) (GXmlDomNode*, GXmlDomNode*)) gxml_node_real_is_equal_node;
	iface->compare_document_position = (GXmlDomNodeDocumentPosition (*) (GXmlDomNode*, GXmlDomNode*)) gxml_node_real_compare_document_position;
	iface->contains = (gboolean (*) (GXmlDomNode*, GXmlDomNode*)) gxml_node_real_contains;
	iface->lookup_prefix = (gchar* (*) (GXmlDomNode*, const gchar*)) gxml_node_real_lookup_prefix;
	iface->lookup_namespace_uri = (gchar* (*) (GXmlDomNode*, const gchar*)) gxml_node_real_lookup_namespace_uri;
	iface->is_default_namespace = (gboolean (*) (GXmlDomNode*, const gchar*)) gxml_node_real_is_default_namespace;
	iface->insert_before = (GXmlDomNode* (*) (GXmlDomNode*, GXmlDomNode*, GXmlDomNode*, GError**)) gxml_node_real_insert_before;
	iface->append_child = (GXmlDomNode* (*) (GXmlDomNode*, GXmlDomNode*, GError**)) gxml_node_real_append_child;
	iface->replace_child = (GXmlDomNode* (*) (GXmlDomNode*, GXmlDomNode*, GXmlDomNode*, GError**)) gxml_node_real_replace_child;
	iface->remove_child = (GXmlDomNode* (*) (GXmlDomNode*, GXmlDomNode*, GError**)) gxml_node_real_remove_child;
	iface->get_node_type = gxml_node_real_get_node_type;
	iface->get_node_name = gxml_node_real_get_node_name;
	iface->get_base_uri = gxml_node_real_get_base_uri;
	iface->get_owner_document = gxml_node_real_get_owner_document;
	iface->set_owner_document = gxml_node_real_set_owner_document;
	iface->get_parent_node = gxml_node_real_get_parent_node;
	iface->get_parent_element = gxml_node_real_get_parent_element;
	iface->get_child_nodes = gxml_node_real_get_child_nodes;
	iface->get_first_child = gxml_node_real_get_first_child;
	iface->get_last_child = gxml_node_real_get_last_child;
	iface->get_previous_sibling = gxml_node_real_get_previous_sibling;
	iface->get_next_sibling = gxml_node_real_get_next_sibling;
	iface->get_node_value = gxml_node_real_get_node_value;
	iface->set_node_value = gxml_node_real_set_node_value;
	iface->get_text_content = gxml_node_real_get_text_content;
	iface->set_text_content = gxml_node_real_set_text_content;
}

static void
gxml_node_instance_init (GXmlNode * self,
                         gpointer klass)
{
}

static void
gxml_node_finalize (GObject * obj)
{
	GXmlNode * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_NODE, GXmlNode);
	_g_free0 (self->_local_name);
	_g_free0 (self->_prefix);
	_g_free0 (self->_base_uri);
	_g_free0 (self->_node_value);
	_g_object_unref0 (self->_parent);
	_g_object_unref0 (self->_child_nodes);
	_g_object_unref0 (self->_document);
	G_OBJECT_CLASS (gxml_node_parent_class)->finalize (obj);
}

/**
 * A DOM4 implementation of {@link DomNode}, 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.
 */
static GType
gxml_node_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlNodeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_node_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlNode), 0, (GInstanceInitFunc) gxml_node_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_event_target_info = { (GInterfaceInitFunc) gxml_node_gxml_dom_event_target_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_node_info = { (GInterfaceInitFunc) gxml_node_gxml_dom_node_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_node_type_id;
	gxml_node_type_id = g_type_register_static (G_TYPE_OBJECT, "GXmlNode", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_node_type_id, GXML_TYPE_DOM_EVENT_TARGET, &gxml_dom_event_target_info);
	g_type_add_interface_static (gxml_node_type_id, GXML_TYPE_DOM_NODE, &gxml_dom_node_info);
	return gxml_node_type_id;
}

GType
gxml_node_get_type (void)
{
	static volatile gsize gxml_node_type_id__once = 0;
	if (g_once_init_enter (&gxml_node_type_id__once)) {
		GType gxml_node_type_id;
		gxml_node_type_id = gxml_node_get_type_once ();
		g_once_init_leave (&gxml_node_type_id__once, gxml_node_type_id);
	}
	return gxml_node_type_id__once;
}

static void
_vala_gxml_node_get_property (GObject * object,
                              guint property_id,
                              GValue * value,
                              GParamSpec * pspec)
{
	GXmlNode * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_NODE, GXmlNode);
	switch (property_id) {
		case GXML_NODE_NODE_TYPE_PROPERTY:
		g_value_set_enum (value, gxml_dom_node_get_node_type ((GXmlDomNode*) self));
		break;
		case GXML_NODE_NODE_NAME_PROPERTY:
		g_value_take_string (value, gxml_dom_node_get_node_name ((GXmlDomNode*) self));
		break;
		case GXML_NODE_BASE_URI_PROPERTY:
		g_value_set_string (value, gxml_dom_node_get_base_uri ((GXmlDomNode*) self));
		break;
		case GXML_NODE_OWNER_DOCUMENT_PROPERTY:
		g_value_set_object (value, gxml_dom_node_get_owner_document ((GXmlDomNode*) self));
		break;
		case GXML_NODE_PARENT_NODE_PROPERTY:
		g_value_take_object (value, gxml_dom_node_get_parent_node ((GXmlDomNode*) self));
		break;
		case GXML_NODE_PARENT_ELEMENT_PROPERTY:
		g_value_take_object (value, gxml_dom_node_get_parent_element ((GXmlDomNode*) self));
		break;
		case GXML_NODE_CHILD_NODES_PROPERTY:
		g_value_take_object (value, gxml_dom_node_get_child_nodes ((GXmlDomNode*) self));
		break;
		case GXML_NODE_FIRST_CHILD_PROPERTY:
		g_value_take_object (value, gxml_dom_node_get_first_child ((GXmlDomNode*) self));
		break;
		case GXML_NODE_LAST_CHILD_PROPERTY:
		g_value_take_object (value, gxml_dom_node_get_last_child ((GXmlDomNode*) self));
		break;
		case GXML_NODE_PREVIOUS_SIBLING_PROPERTY:
		g_value_take_object (value, gxml_dom_node_get_previous_sibling ((GXmlDomNode*) self));
		break;
		case GXML_NODE_NEXT_SIBLING_PROPERTY:
		g_value_take_object (value, gxml_dom_node_get_next_sibling ((GXmlDomNode*) self));
		break;
		case GXML_NODE_NODE_VALUE_PROPERTY:
		g_value_take_string (value, gxml_dom_node_get_node_value ((GXmlDomNode*) self));
		break;
		case GXML_NODE_TEXT_CONTENT_PROPERTY:
		g_value_take_string (value, gxml_dom_node_get_text_content ((GXmlDomNode*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gxml_node_set_property (GObject * object,
                              guint property_id,
                              const GValue * value,
                              GParamSpec * pspec)
{
	GXmlNode * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_NODE, GXmlNode);
	switch (property_id) {
		case GXML_NODE_OWNER_DOCUMENT_PROPERTY:
		gxml_dom_node_set_owner_document ((GXmlDomNode*) self, g_value_get_object (value));
		break;
		case GXML_NODE_NODE_VALUE_PROPERTY:
		gxml_dom_node_set_node_value ((GXmlDomNode*) self, g_value_get_string (value));
		break;
		case GXML_NODE_TEXT_CONTENT_PROPERTY:
		gxml_dom_node_set_text_content ((GXmlDomNode*) self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static GXmlDomNode*
gxml_node_list_real_item (GXmlDomNodeList* base,
                          gint index)
{
	GXmlNodeList * self;
	gpointer _tmp0_;
	GXmlDomNode* result;
	self = (GXmlNodeList*) base;
	_tmp0_ = GEE_ABSTRACT_LIST_CLASS (gxml_node_list_parent_class)->get ((GeeAbstractList*) G_TYPE_CHECK_INSTANCE_CAST (self, GEE_TYPE_ARRAY_LIST, GeeArrayList), index);
	result = (GXmlDomNode*) _tmp0_;
	return result;
}

static gint
gxml_node_list_real_get_length (GXmlDomNodeList* base)
{
	gint result;
	GXmlNodeList* self;
	gint _tmp0_;
	gint _tmp1_;
	self = (GXmlNodeList*) base;
	_tmp0_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) self);
	_tmp1_ = _tmp0_;
	result = _tmp1_;
	return result;
}

GXmlNodeList*
gxml_node_list_construct (GType object_type)
{
	GXmlNodeList * self = NULL;
	self = (GXmlNodeList*) gee_array_list_construct (object_type, GXML_TYPE_DOM_NODE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	return self;
}

GXmlNodeList*
gxml_node_list_new (void)
{
	return gxml_node_list_construct (GXML_TYPE_NODE_LIST);
}

static void
gxml_node_list_class_init (GXmlNodeListClass * klass,
                           gpointer klass_data)
{
	gxml_node_list_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_node_list_get_property;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_NODE_LIST_LENGTH_PROPERTY, gxml_node_list_properties[GXML_NODE_LIST_LENGTH_PROPERTY] = g_param_spec_int ("length", "length", "length", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gxml_node_list_gxml_dom_node_list_interface_init (GXmlDomNodeListIface * iface,
                                                  gpointer iface_data)
{
	gxml_node_list_gxml_dom_node_list_parent_iface = g_type_interface_peek_parent (iface);
	iface->item = (GXmlDomNode* (*) (GXmlDomNodeList*, gint)) gxml_node_list_real_item;
	iface->get_length = gxml_node_list_real_get_length;
}

static void
gxml_node_list_instance_init (GXmlNodeList * self,
                              gpointer klass)
{
}

/**
 * List of {@link DomNode} implementing {@link DomNodeList}
 */
static GType
gxml_node_list_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlNodeListClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_node_list_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlNodeList), 0, (GInstanceInitFunc) gxml_node_list_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_node_list_info = { (GInterfaceInitFunc) gxml_node_list_gxml_dom_node_list_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_node_list_type_id;
	gxml_node_list_type_id = g_type_register_static (GEE_TYPE_ARRAY_LIST, "GXmlNodeList", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_node_list_type_id, GXML_TYPE_DOM_NODE_LIST, &gxml_dom_node_list_info);
	return gxml_node_list_type_id;
}

GType
gxml_node_list_get_type (void)
{
	static volatile gsize gxml_node_list_type_id__once = 0;
	if (g_once_init_enter (&gxml_node_list_type_id__once)) {
		GType gxml_node_list_type_id;
		gxml_node_list_type_id = gxml_node_list_get_type_once ();
		g_once_init_leave (&gxml_node_list_type_id__once, gxml_node_list_type_id);
	}
	return gxml_node_list_type_id__once;
}

static void
_vala_gxml_node_list_get_property (GObject * object,
                                   guint property_id,
                                   GValue * value,
                                   GParamSpec * pspec)
{
	GXmlNodeList * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_NODE_LIST, GXmlNodeList);
	switch (property_id) {
		case GXML_NODE_LIST_LENGTH_PROPERTY:
		g_value_set_int (value, gxml_dom_node_list_get_length ((GXmlDomNodeList*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

