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

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/* GElement.vala
 *
 * Copyright (C) 2016  Daniel Espinosa <esodan@gmail.com>
 * Copyright (C) 2016  Yannick Inizan <inizan.yannick@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>
 *      Yannick Inizan <inizan.yannick@gmail.com>
 */

#include "gxml/gxml.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
#include <gee.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.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_XELEMENT_0_PROPERTY,
	GXML_XELEMENT_VALUE_PROPERTY,
	GXML_XELEMENT_CONTENT_PROPERTY,
	GXML_XELEMENT_TAG_NAME_PROPERTY,
	GXML_XELEMENT_NAMESPACE_URI_PROPERTY,
	GXML_XELEMENT_PREFIX_PROPERTY,
	GXML_XELEMENT_LOCAL_NAME_PROPERTY,
	GXML_XELEMENT_ID_PROPERTY,
	GXML_XELEMENT_CLASS_NAME_PROPERTY,
	GXML_XELEMENT_CLASS_LIST_PROPERTY,
	GXML_XELEMENT_ATTRIBUTES_PROPERTY,
	GXML_XELEMENT_CHILDREN_PROPERTY,
	GXML_XELEMENT_FIRST_ELEMENT_CHILD_PROPERTY,
	GXML_XELEMENT_LAST_ELEMENT_CHILD_PROPERTY,
	GXML_XELEMENT_CHILD_ELEMENT_COUNT_PROPERTY,
	GXML_XELEMENT_NUM_PROPERTIES
};
static GParamSpec* gxml_xelement_properties[GXML_XELEMENT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _xmlBufferFree0(var) ((var == NULL) ? NULL : (var = (xmlBufferFree (var), NULL)))
#define _xmlXPathFreeContext0(var) ((var == NULL) ? NULL : (var = (xmlXPathFreeContext (var), NULL)))

static gpointer gxml_xelement_parent_class = NULL;
static GXmlDomParentNodeIface * gxml_xelement_gxml_dom_parent_node_parent_iface = NULL;
static GXmlDomElementIface * gxml_xelement_gxml_dom_element_parent_iface = NULL;
static GXmlXPathContextIface * gxml_xelement_gxml_xpath_context_parent_iface = NULL;

static gchar* gxml_xelement_real_to_string (GXmlXNode* base);
static gchar* gxml_xelement_real_write_string (GXmlDomElement* base,
                                        GCancellable* cancellable,
                                        GError** error);
static gchar* gxml_xelement_real_get_attribute (GXmlDomElement* base,
                                         const gchar* name);
static gchar* gxml_xelement_real_get_attribute_ns (GXmlDomElement* base,
                                            const gchar* namespace,
                                            const gchar* local_name);
static void gxml_xelement_real_set_attribute (GXmlDomElement* base,
                                       const gchar* name,
                                       const gchar* value,
                                       GError** error);
static void gxml_xelement_real_set_attribute_ns (GXmlDomElement* base,
                                          const gchar* namespace,
                                          const gchar* name,
                                          const gchar* value,
                                          GError** error);
static void gxml_xelement_real_remove_attribute (GXmlDomElement* base,
                                          const gchar* name);
static void gxml_xelement_real_remove_attribute_ns (GXmlDomElement* base,
                                             const gchar* namespace,
                                             const gchar* local_name);
static gboolean gxml_xelement_real_has_attribute (GXmlDomElement* base,
                                           const gchar* name);
static gboolean gxml_xelement_real_has_attribute_ns (GXmlDomElement* base,
                                              const gchar* namespace,
                                              const gchar* local_name);
static GXmlDomHTMLCollection* gxml_xelement_real_get_elements_by_tag_name (GXmlDomElement* base,
                                                                    const gchar* local_name);
static GXmlDomHTMLCollection* gxml_xelement_real_get_elements_by_tag_name_ns (GXmlDomElement* base,
                                                                       const gchar* namespace,
                                                                       const gchar* local_name);
static GXmlDomHTMLCollection* gxml_xelement_real_get_elements_by_class_name (GXmlDomElement* base,
                                                                      const gchar* class_names);
static void _vala_array_add5 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add6 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static GXmlDomNodeList* gxml_xelement_real_query_selector_all (GXmlDomParentNode* base,
                                                        const gchar* selectors,
                                                        GError** error);
static GXmlXPathObject* gxml_xelement_real_evaluate (GXmlXPathContext* base,
                                              const gchar* expression,
                                              GeeMap* resolver,
                                              GError** error);
static GType gxml_xelement_get_type_once (void);
static void _vala_gxml_xelement_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static void _vala_gxml_xelement_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 _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

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

GXmlXElement*
gxml_xelement_construct (GType object_type,
                         GXmlXDocument* doc,
                         xmlNode* node)
{
	GXmlXElement * self = NULL;
	GXmlXDocument* _tmp0_;
	g_return_val_if_fail (doc != NULL, NULL);
	self = (GXmlXElement*) gxml_xnon_document_child_node_construct (object_type);
	((GXmlXNode*) self)->_node = node;
	_tmp0_ = _g_object_ref0 (doc);
	_g_object_unref0 (((GXmlXNode*) self)->_doc);
	((GXmlXNode*) self)->_doc = _tmp0_;
	return self;
}

GXmlXElement*
gxml_xelement_new (GXmlXDocument* doc,
                   xmlNode* node)
{
	return gxml_xelement_construct (GXML_TYPE_XELEMENT, doc, node);
}

static gchar*
gxml_xelement_real_get_value (GXmlXNode* base)
{
	gchar* result;
	GXmlXElement* self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlXElement*) base;
	_tmp0_ = gxml_xelement_get_content (self);
	_tmp1_ = _tmp0_;
	result = _tmp1_;
	return result;
}

static void
gxml_xelement_real_set_value (GXmlXNode* base,
                              const gchar* value)
{
	GXmlXElement* self;
	self = (GXmlXElement*) base;
	gxml_xelement_set_content (self, value);
	g_object_notify_by_pspec ((GObject *) self, gxml_xelement_properties[GXML_XELEMENT_VALUE_PROPERTY]);
}

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

void
gxml_xelement_set_attr (GXmlXElement* self,
                        const gchar* aname,
                        const gchar* avalue)
{
	xmlNode* _tmp0_;
	xmlNode* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (aname != NULL);
	g_return_if_fail (avalue != NULL);
	_tmp0_ = ((GXmlXNode*) self)->_node;
	if (_tmp0_ == NULL) {
		return;
	}
	if (string_contains (aname, ":")) {
		return;
	}
	_tmp1_ = ((GXmlXNode*) self)->_node;
	xmlSetProp (_tmp1_, (xmlChar*) aname, (xmlChar*) avalue);
}

GXmlDomNode*
gxml_xelement_get_attr (GXmlXElement* self,
                        const gchar* name)
{
	xmlNode* _tmp0_;
	gchar* prefix = NULL;
	gchar* n = NULL;
	gchar* _tmp1_;
	const gchar* _tmp11_;
	xmlAttr* p = NULL;
	xmlNode* _tmp27_;
	const gchar* _tmp28_;
	xmlAttr* _tmp29_;
	xmlAttr* _tmp30_;
	GXmlXDocument* _tmp31_;
	xmlAttr* _tmp32_;
	GXmlXAttribute* _tmp33_;
	GXmlDomNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = ((GXmlXNode*) self)->_node;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	prefix = NULL;
	_tmp1_ = g_strdup (name);
	n = _tmp1_;
	if (string_contains (name, ":")) {
		gchar** pp = NULL;
		gchar** _tmp2_;
		gchar** _tmp3_;
		gint pp_length1;
		gint _pp_size_;
		gchar** _tmp4_;
		gint _tmp4__length1;
		gchar** _tmp5_;
		gint _tmp5__length1;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar** _tmp8_;
		gint _tmp8__length1;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = _tmp2_ = g_strsplit (name, ":", 0);
		pp = _tmp3_;
		pp_length1 = _vala_array_length (_tmp2_);
		_pp_size_ = pp_length1;
		_tmp4_ = pp;
		_tmp4__length1 = pp_length1;
		if (_tmp4__length1 != 2) {
			result = NULL;
			pp = (_vala_array_free (pp, pp_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (n);
			_g_free0 (prefix);
			return result;
		}
		_tmp5_ = pp;
		_tmp5__length1 = pp_length1;
		_tmp6_ = _tmp5_[0];
		_tmp7_ = g_strdup (_tmp6_);
		_g_free0 (prefix);
		prefix = _tmp7_;
		_tmp8_ = pp;
		_tmp8__length1 = pp_length1;
		_tmp9_ = _tmp8_[1];
		_tmp10_ = g_strdup (_tmp9_);
		_g_free0 (n);
		n = _tmp10_;
		pp = (_vala_array_free (pp, pp_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp11_ = prefix;
	if (_tmp11_ != NULL) {
		xmlNs* ns = NULL;
		xmlNode* _tmp12_;
		xmlDoc* _tmp13_;
		xmlNode* _tmp14_;
		const gchar* _tmp15_;
		xmlNs* _tmp16_;
		xmlNs* _tmp17_;
		xmlAttr* nsa = NULL;
		xmlNode* _tmp18_;
		const gchar* _tmp19_;
		xmlNs* _tmp20_;
		const gchar* _tmp21_;
		xmlAttr* _tmp22_;
		xmlAttr* _tmp23_;
		GXmlXDocument* _tmp24_;
		xmlAttr* _tmp25_;
		GXmlXAttribute* _tmp26_;
		_tmp12_ = ((GXmlXNode*) self)->_node;
		_tmp13_ = _tmp12_->doc;
		_tmp14_ = ((GXmlXNode*) self)->_node;
		_tmp15_ = prefix;
		_tmp16_ = xmlSearchNs (_tmp13_, _tmp14_, _tmp15_);
		ns = _tmp16_;
		_tmp17_ = ns;
		if (_tmp17_ == NULL) {
			result = NULL;
			_g_free0 (n);
			_g_free0 (prefix);
			return result;
		}
		_tmp18_ = ((GXmlXNode*) self)->_node;
		_tmp19_ = n;
		_tmp20_ = ns;
		_tmp21_ = _tmp20_->href;
		_tmp22_ = xmlHasNsProp (_tmp18_, (xmlChar*) _tmp19_, (xmlChar*) _tmp21_);
		nsa = _tmp22_;
		_tmp23_ = nsa;
		if (_tmp23_ == NULL) {
			result = NULL;
			_g_free0 (n);
			_g_free0 (prefix);
			return result;
		}
		_tmp24_ = ((GXmlXNode*) self)->_doc;
		_tmp25_ = nsa;
		_tmp26_ = gxml_xattribute_new (_tmp24_, _tmp25_);
		result = (GXmlDomNode*) _tmp26_;
		_g_free0 (n);
		_g_free0 (prefix);
		return result;
	}
	_tmp27_ = ((GXmlXNode*) self)->_node;
	_tmp28_ = n;
	_tmp29_ = xmlHasProp (_tmp27_, (xmlChar*) _tmp28_);
	p = _tmp29_;
	_tmp30_ = p;
	if (_tmp30_ == NULL) {
		result = NULL;
		_g_free0 (n);
		_g_free0 (prefix);
		return result;
	}
	_tmp31_ = ((GXmlXNode*) self)->_doc;
	_tmp32_ = p;
	_tmp33_ = gxml_xattribute_new (_tmp31_, _tmp32_);
	result = (GXmlDomNode*) _tmp33_;
	_g_free0 (n);
	_g_free0 (prefix);
	return result;
}

void
gxml_xelement_set_ns_attr (GXmlXElement* self,
                           const gchar* ns,
                           const gchar* aname,
                           const gchar* value)
{
	xmlNode* _tmp0_;
	gchar* prefix = NULL;
	gchar* qname = NULL;
	gchar* _tmp1_;
	xmlNs* ins = NULL;
	xmlNode* _tmp11_;
	xmlDoc* _tmp12_;
	xmlNode* _tmp13_;
	xmlNs* _tmp14_;
	xmlNs* _tmp15_;
	xmlNs* nns = NULL;
	xmlNode* _tmp19_;
	const gchar* _tmp20_;
	xmlNs* _tmp21_;
	xmlNs* _tmp22_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (ns != NULL);
	g_return_if_fail (aname != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = ((GXmlXNode*) self)->_node;
	if (_tmp0_ == NULL) {
		return;
	}
	prefix = NULL;
	_tmp1_ = g_strdup (aname);
	qname = _tmp1_;
	if (string_contains (aname, ":")) {
		gchar** s = NULL;
		gchar** _tmp2_;
		gchar** _tmp3_;
		gint s_length1;
		gint _s_size_;
		gchar** _tmp4_;
		gint _tmp4__length1;
		gchar** _tmp5_;
		gint _tmp5__length1;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar** _tmp8_;
		gint _tmp8__length1;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = _tmp2_ = g_strsplit (aname, ":", 0);
		s = _tmp3_;
		s_length1 = _vala_array_length (_tmp2_);
		_s_size_ = s_length1;
		_tmp4_ = s;
		_tmp4__length1 = s_length1;
		if (_tmp4__length1 != 2) {
			s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (qname);
			_g_free0 (prefix);
			return;
		}
		_tmp5_ = s;
		_tmp5__length1 = s_length1;
		_tmp6_ = _tmp5_[0];
		_tmp7_ = g_strdup (_tmp6_);
		_g_free0 (prefix);
		prefix = _tmp7_;
		_tmp8_ = s;
		_tmp8__length1 = s_length1;
		_tmp9_ = _tmp8_[1];
		_tmp10_ = g_strdup (_tmp9_);
		_g_free0 (qname);
		qname = _tmp10_;
		s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp11_ = ((GXmlXNode*) self)->_node;
	_tmp12_ = _tmp11_->doc;
	_tmp13_ = ((GXmlXNode*) self)->_node;
	_tmp14_ = xmlSearchNsByHref (_tmp12_, _tmp13_, ns);
	ins = _tmp14_;
	_tmp15_ = ins;
	if (_tmp15_ != NULL) {
		xmlNode* _tmp16_;
		xmlNs* _tmp17_;
		const gchar* _tmp18_;
		_tmp16_ = ((GXmlXNode*) self)->_node;
		_tmp17_ = ins;
		_tmp18_ = qname;
		xmlSetNsProp (_tmp16_, _tmp17_, (xmlChar*) _tmp18_, (xmlChar*) value);
		_g_free0 (qname);
		_g_free0 (prefix);
		return;
	}
	_tmp19_ = ((GXmlXNode*) self)->_node;
	_tmp20_ = prefix;
	_tmp21_ = xmlNewNs (_tmp19_, (xmlChar*) ns, (xmlChar*) _tmp20_);
	nns = _tmp21_;
	_tmp22_ = nns;
	if (_tmp22_ != NULL) {
		xmlNode* _tmp23_;
		xmlNs* _tmp24_;
		const gchar* _tmp25_;
		_tmp23_ = ((GXmlXNode*) self)->_node;
		_tmp24_ = nns;
		_tmp25_ = qname;
		xmlSetNsProp (_tmp23_, _tmp24_, (xmlChar*) _tmp25_, (xmlChar*) value);
	}
	_g_free0 (qname);
	_g_free0 (prefix);
}

GXmlDomNode*
gxml_xelement_get_ns_attr (GXmlXElement* self,
                           const gchar* name,
                           const gchar* uri)
{
	xmlNode* _tmp0_;
	xmlAttr* a = NULL;
	xmlNode* _tmp1_;
	xmlAttr* _tmp2_;
	xmlAttr* _tmp3_;
	GXmlXDocument* _tmp4_;
	xmlAttr* _tmp5_;
	GXmlXAttribute* _tmp6_;
	GXmlDomNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (uri != NULL, NULL);
	_tmp0_ = ((GXmlXNode*) self)->_node;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = ((GXmlXNode*) self)->_node;
	_tmp2_ = xmlHasNsProp (_tmp1_, (xmlChar*) name, (xmlChar*) uri);
	a = _tmp2_;
	_tmp3_ = a;
	if (_tmp3_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp4_ = ((GXmlXNode*) self)->_doc;
	_tmp5_ = a;
	_tmp6_ = gxml_xattribute_new (_tmp4_, _tmp5_);
	result = (GXmlDomNode*) _tmp6_;
	return result;
}

void
gxml_xelement_normalize (GXmlXElement* self)
{
	g_return_if_fail (self != NULL);
}

gchar*
gxml_xelement_get_content (GXmlXElement* self)
{
	gchar* result;
	xmlNode* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = ((GXmlXNode*) self)->_node;
	_tmp1_ = (gchar*) xmlNodeGetContent (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	_tmp4_ = _tmp3_;
	_g_free0 (_tmp2_);
	result = _tmp4_;
	return result;
}

void
gxml_xelement_set_content (GXmlXElement* self,
                           const gchar* value)
{
	xmlNode* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ((GXmlXNode*) self)->_node;
	xmlNodeSetContent (_tmp0_, (xmlChar*) value);
	g_object_notify_by_pspec ((GObject *) self, gxml_xelement_properties[GXML_XELEMENT_CONTENT_PROPERTY]);
}

void
gxml_xelement_remove_attr (GXmlXElement* self,
                           const gchar* name)
{
	xmlNode* _tmp0_;
	xmlAttr* a = NULL;
	xmlNode* _tmp1_;
	xmlAttr* _tmp2_;
	xmlAttr* _tmp3_;
	xmlAttr* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = ((GXmlXNode*) self)->_node;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = ((GXmlXNode*) self)->_node;
	_tmp2_ = xmlHasProp (_tmp1_, (xmlChar*) name);
	a = _tmp2_;
	_tmp3_ = a;
	if (_tmp3_ == NULL) {
		return;
	}
	_tmp4_ = a;
	xmlRemoveProp (_tmp4_);
}

void
gxml_xelement_remove_ns_attr (GXmlXElement* self,
                              const gchar* name,
                              const gchar* uri)
{
	xmlNode* _tmp0_;
	xmlAttr* a = NULL;
	xmlNode* _tmp1_;
	xmlAttr* _tmp2_;
	xmlAttr* _tmp3_;
	xmlAttr* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (uri != NULL);
	_tmp0_ = ((GXmlXNode*) self)->_node;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = ((GXmlXNode*) self)->_node;
	_tmp2_ = xmlHasNsProp (_tmp1_, (xmlChar*) name, (xmlChar*) uri);
	a = _tmp2_;
	_tmp3_ = a;
	if (_tmp3_ == NULL) {
		return;
	}
	_tmp4_ = a;
	xmlRemoveProp (_tmp4_);
}

static gchar*
gxml_xelement_real_get_tag_name (GXmlDomElement* base)
{
	gchar* result;
	GXmlXElement* self;
	xmlNode* _tmp0_;
	xmlNs* ns = NULL;
	xmlNode* _tmp2_;
	xmlNs* _tmp3_;
	xmlNs* dns = NULL;
	xmlNs* _tmp4_;
	xmlNs* _tmp11_;
	xmlNode* _tmp35_;
	const gchar* _tmp36_;
	gchar* _tmp37_;
	self = (GXmlXElement*) base;
	_tmp0_ = ((GXmlXNode*) self)->_node;
	if (_tmp0_ == NULL) {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("");
		result = _tmp1_;
		return result;
	}
	_tmp2_ = ((GXmlXNode*) self)->_node;
	_tmp3_ = _tmp2_->nsDef;
	ns = _tmp3_;
	_tmp4_ = ns;
	dns = _tmp4_;
	while (TRUE) {
		xmlNs* _tmp5_;
		xmlNs* _tmp6_;
		const gchar* _tmp7_;
		xmlNs* _tmp9_;
		xmlNs* _tmp10_;
		_tmp5_ = ns;
		if (!(_tmp5_ != NULL)) {
			break;
		}
		_tmp6_ = ns;
		_tmp7_ = _tmp6_->prefix;
		if (_tmp7_ == NULL) {
			xmlNs* _tmp8_;
			_tmp8_ = ns;
			dns = _tmp8_;
		}
		_tmp9_ = ns;
		_tmp10_ = _tmp9_->next;
		ns = _tmp10_;
	}
	_tmp11_ = dns;
	if (_tmp11_ != NULL) {
		xmlNs* _tmp12_;
		const gchar* _tmp13_;
		xmlNs* _tmp20_;
		const gchar* _tmp21_;
		gchar* qname = NULL;
		xmlNs* _tmp25_;
		const gchar* _tmp26_;
		gchar* _tmp27_;
		gchar* _tmp28_;
		xmlNode* _tmp29_;
		const gchar* _tmp30_;
		gchar* _tmp31_;
		gchar* _tmp32_;
		const gchar* _tmp33_;
		gchar* _tmp34_;
		_tmp12_ = dns;
		_tmp13_ = _tmp12_->href;
		if (g_strcmp0 (_tmp13_, "http://www.w3.org/1999/xhtml") == 0) {
			xmlNode* _tmp14_;
			const gchar* _tmp15_;
			gchar* _tmp16_;
			gchar* _tmp17_;
			gchar* _tmp18_;
			gchar* _tmp19_;
			_tmp14_ = ((GXmlXNode*) self)->_node;
			_tmp15_ = _tmp14_->name;
			_tmp16_ = g_utf8_strup (_tmp15_, (gssize) -1);
			_tmp17_ = _tmp16_;
			_tmp18_ = g_strdup (_tmp17_);
			_tmp19_ = _tmp18_;
			_g_free0 (_tmp17_);
			result = _tmp19_;
			return result;
		}
		_tmp20_ = dns;
		_tmp21_ = _tmp20_->prefix;
		if (_tmp21_ == NULL) {
			xmlNode* _tmp22_;
			const gchar* _tmp23_;
			gchar* _tmp24_;
			_tmp22_ = ((GXmlXNode*) self)->_node;
			_tmp23_ = _tmp22_->name;
			_tmp24_ = g_strdup (_tmp23_);
			result = _tmp24_;
			return result;
		}
		_tmp25_ = dns;
		_tmp26_ = _tmp25_->prefix;
		_tmp27_ = g_strconcat (_tmp26_, ":", NULL);
		_tmp28_ = _tmp27_;
		_tmp29_ = ((GXmlXNode*) self)->_node;
		_tmp30_ = _tmp29_->name;
		_tmp31_ = g_strconcat (_tmp28_, _tmp30_, NULL);
		_tmp32_ = _tmp31_;
		_g_free0 (_tmp28_);
		qname = _tmp32_;
		_tmp33_ = qname;
		_tmp34_ = g_strdup (_tmp33_);
		result = _tmp34_;
		_g_free0 (qname);
		return result;
	}
	_tmp35_ = ((GXmlXNode*) self)->_node;
	_tmp36_ = _tmp35_->name;
	_tmp37_ = g_strdup (_tmp36_);
	result = _tmp37_;
	return result;
}

static gchar*
gxml_xelement_real_to_string (GXmlXNode* base)
{
	GXmlXElement * self;
	gchar* _tmp5_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	self = (GXmlXElement*) base;
	{
		gchar* _tmp0_ = NULL;
		gchar* _tmp1_;
		gchar* _tmp2_;
		_tmp1_ = gxml_dom_element_write_string ((GXmlDomElement*) self, NULL, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		result = _tmp2_;
		_g_free0 (_tmp0_);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		const gchar* _tmp4_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		g_warning (_ ("Error while converting Element to string: %s"), _tmp4_);
		_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;
	}
	_tmp5_ = g_strdup ("");
	result = _tmp5_;
	return result;
}

static gchar*
gxml_xelement_real_write_string (GXmlDomElement* base,
                                 GCancellable* cancellable,
                                 GError** error)
{
	GXmlXElement * self;
	xmlBuffer* buf = NULL;
	xmlBuffer* _tmp0_;
	xmlNode* _tmp1_;
	xmlDoc* _tmp2_;
	xmlNode* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* result;
	self = (GXmlXElement*) base;
	_tmp0_ = xmlBufferCreate ();
	buf = _tmp0_;
	_tmp1_ = ((GXmlXNode*) self)->_node;
	_tmp2_ = _tmp1_->doc;
	_tmp3_ = ((GXmlXNode*) self)->_node;
	xmlNodeDump (buf, _tmp2_, _tmp3_, 1, 0);
	_tmp4_ = xmlBufferContent (buf);
	_tmp5_ = g_strdup (_tmp4_);
	result = _tmp5_;
	_xmlBufferFree0 (buf);
	return result;
}

static gchar*
gxml_xelement_real_get_namespace_uri (GXmlDomElement* base)
{
	gchar* result;
	GXmlXElement* self;
	xmlNode* _tmp0_;
	xmlNs* ns = NULL;
	xmlNode* _tmp1_;
	xmlNs* _tmp2_;
	xmlNs* dns = NULL;
	xmlNs* _tmp3_;
	xmlNs* _tmp10_;
	self = (GXmlXElement*) base;
	_tmp0_ = ((GXmlXNode*) self)->_node;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = ((GXmlXNode*) self)->_node;
	_tmp2_ = _tmp1_->nsDef;
	ns = _tmp2_;
	_tmp3_ = ns;
	dns = _tmp3_;
	while (TRUE) {
		xmlNs* _tmp4_;
		xmlNs* _tmp5_;
		const gchar* _tmp6_;
		xmlNs* _tmp8_;
		xmlNs* _tmp9_;
		_tmp4_ = ns;
		if (!(_tmp4_ != NULL)) {
			break;
		}
		_tmp5_ = ns;
		_tmp6_ = _tmp5_->prefix;
		if (_tmp6_ == NULL) {
			xmlNs* _tmp7_;
			_tmp7_ = ns;
			dns = _tmp7_;
		}
		_tmp8_ = ns;
		_tmp9_ = _tmp8_->next;
		ns = _tmp9_;
	}
	_tmp10_ = dns;
	if (_tmp10_ != NULL) {
		xmlNs* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		_tmp11_ = dns;
		_tmp12_ = _tmp11_->href;
		_tmp13_ = g_strdup (_tmp12_);
		result = _tmp13_;
		return result;
	}
	result = NULL;
	return result;
}

static gchar*
gxml_xelement_real_get_prefix (GXmlDomElement* base)
{
	gchar* result;
	GXmlXElement* self;
	xmlNode* _tmp0_;
	xmlNs* ns = NULL;
	xmlNode* _tmp1_;
	xmlNs* _tmp2_;
	xmlNs* dns = NULL;
	xmlNs* _tmp3_;
	xmlNs* _tmp10_;
	self = (GXmlXElement*) base;
	_tmp0_ = ((GXmlXNode*) self)->_node;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = ((GXmlXNode*) self)->_node;
	_tmp2_ = _tmp1_->nsDef;
	ns = _tmp2_;
	_tmp3_ = ns;
	dns = _tmp3_;
	while (TRUE) {
		xmlNs* _tmp4_;
		xmlNs* _tmp5_;
		const gchar* _tmp6_;
		xmlNs* _tmp8_;
		xmlNs* _tmp9_;
		_tmp4_ = ns;
		if (!(_tmp4_ != NULL)) {
			break;
		}
		_tmp5_ = ns;
		_tmp6_ = _tmp5_->prefix;
		if (_tmp6_ == NULL) {
			xmlNs* _tmp7_;
			_tmp7_ = ns;
			dns = _tmp7_;
		}
		_tmp8_ = ns;
		_tmp9_ = _tmp8_->next;
		ns = _tmp9_;
	}
	_tmp10_ = dns;
	if (_tmp10_ != NULL) {
		xmlNs* _tmp11_;
		const gchar* _tmp12_;
		_tmp11_ = dns;
		_tmp12_ = _tmp11_->prefix;
		if (_tmp12_ != NULL) {
			xmlNs* _tmp13_;
			const gchar* _tmp14_;
			gchar* _tmp15_;
			_tmp13_ = dns;
			_tmp14_ = _tmp13_->prefix;
			_tmp15_ = g_strdup (_tmp14_);
			result = _tmp15_;
			return result;
		}
	}
	result = NULL;
	return result;
}

static gchar*
gxml_xelement_real_get_local_name (GXmlDomElement* base)
{
	gchar* result;
	GXmlXElement* self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlXElement*) base;
	_tmp0_ = gxml_xnode_get_name ((GXmlXNode*) self);
	_tmp1_ = _tmp0_;
	result = _tmp1_;
	return result;
}

static gchar*
gxml_xelement_real_get_id (GXmlDomElement* base)
{
	gchar* result;
	GXmlXElement* self;
	GXmlDomNode* p = NULL;
	GeeMap* _tmp0_;
	GeeMap* _tmp1_;
	GeeMap* _tmp2_;
	gpointer _tmp3_;
	GXmlDomNode* _tmp4_;
	GXmlDomNode* _tmp5_;
	GXmlDomNode* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	self = (GXmlXElement*) base;
	_tmp0_ = gxml_xnode_get_attrs ((GXmlXNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_get (_tmp2_, "id");
	_tmp4_ = (GXmlDomNode*) _tmp3_;
	_g_object_unref0 (_tmp2_);
	p = _tmp4_;
	_tmp5_ = p;
	if (_tmp5_ == NULL) {
		result = NULL;
		_g_object_unref0 (p);
		return result;
	}
	_tmp6_ = p;
	_tmp7_ = gxml_xnode_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, GXML_TYPE_XNODE, GXmlXNode));
	_tmp8_ = _tmp7_;
	result = _tmp8_;
	_g_object_unref0 (p);
	return result;
}

static void
gxml_xelement_real_set_id (GXmlDomElement* base,
                           const gchar* value)
{
	GXmlXElement* self;
	GXmlDomNode* p = NULL;
	GeeMap* _tmp0_;
	GeeMap* _tmp1_;
	GeeMap* _tmp2_;
	gpointer _tmp3_;
	GXmlDomNode* _tmp4_;
	GXmlDomNode* _tmp5_;
	self = (GXmlXElement*) base;
	_tmp0_ = gxml_xnode_get_attrs ((GXmlXNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_get (_tmp2_, "id");
	_tmp4_ = (GXmlDomNode*) _tmp3_;
	_g_object_unref0 (_tmp2_);
	p = _tmp4_;
	_tmp5_ = p;
	if (_tmp5_ == NULL) {
		gxml_xelement_set_attr (self, "id", value);
	} else {
		GXmlDomNode* _tmp6_;
		_tmp6_ = p;
		gxml_xnode_set_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, GXML_TYPE_XNODE, GXmlXNode), value);
	}
	_g_object_unref0 (p);
	g_object_notify_by_pspec ((GObject *) self, gxml_xelement_properties[GXML_XELEMENT_ID_PROPERTY]);
}

static gchar*
gxml_xelement_real_get_class_name (GXmlDomElement* base)
{
	gchar* result;
	GXmlXElement* self;
	GXmlDomNode* p = NULL;
	GeeMap* _tmp0_;
	GeeMap* _tmp1_;
	GeeMap* _tmp2_;
	gpointer _tmp3_;
	GXmlDomNode* _tmp4_;
	GXmlDomNode* _tmp5_;
	GXmlDomNode* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	self = (GXmlXElement*) base;
	_tmp0_ = gxml_xnode_get_attrs ((GXmlXNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_get (_tmp2_, "class");
	_tmp4_ = (GXmlDomNode*) _tmp3_;
	_g_object_unref0 (_tmp2_);
	p = _tmp4_;
	_tmp5_ = p;
	if (_tmp5_ == NULL) {
		result = NULL;
		_g_object_unref0 (p);
		return result;
	}
	_tmp6_ = p;
	_tmp7_ = gxml_xnode_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, GXML_TYPE_XNODE, GXmlXNode));
	_tmp8_ = _tmp7_;
	result = _tmp8_;
	_g_object_unref0 (p);
	return result;
}

static void
gxml_xelement_real_set_class_name (GXmlDomElement* base,
                                   const gchar* value)
{
	GXmlXElement* self;
	GXmlDomNode* p = NULL;
	GeeMap* _tmp0_;
	GeeMap* _tmp1_;
	GeeMap* _tmp2_;
	gpointer _tmp3_;
	GXmlDomNode* _tmp4_;
	GXmlDomNode* _tmp5_;
	self = (GXmlXElement*) base;
	_tmp0_ = gxml_xnode_get_attrs ((GXmlXNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_get (_tmp2_, "class");
	_tmp4_ = (GXmlDomNode*) _tmp3_;
	_g_object_unref0 (_tmp2_);
	p = _tmp4_;
	_tmp5_ = p;
	if (_tmp5_ == NULL) {
		gxml_xelement_set_attr (self, "class", value);
	} else {
		GXmlDomNode* _tmp6_;
		_tmp6_ = p;
		gxml_xnode_set_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, GXML_TYPE_XNODE, GXmlXNode), value);
	}
	_g_object_unref0 (p);
	g_object_notify_by_pspec ((GObject *) self, gxml_xelement_properties[GXML_XELEMENT_CLASS_NAME_PROPERTY]);
}

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

static GXmlDomNamedNodeMap*
gxml_xelement_real_get_attributes (GXmlDomElement* base)
{
	GXmlDomNamedNodeMap* result;
	GXmlXElement* self;
	GeeMap* _tmp0_;
	GeeMap* _tmp1_;
	self = (GXmlXElement*) base;
	_tmp0_ = gxml_xnode_get_attrs ((GXmlXNode*) self);
	_tmp1_ = _tmp0_;
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GXML_TYPE_DOM_NAMED_NODE_MAP, GXmlDomNamedNodeMap);
	return result;
}

static gchar*
gxml_xelement_real_get_attribute (GXmlDomElement* base,
                                  const gchar* name)
{
	GXmlXElement * self;
	GXmlDomNode* p = NULL;
	GeeMap* _tmp0_;
	GeeMap* _tmp1_;
	GeeMap* _tmp2_;
	gpointer _tmp3_;
	GXmlDomNode* _tmp4_;
	GXmlDomNode* _tmp5_;
	GXmlDomNode* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* result;
	self = (GXmlXElement*) base;
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = gxml_xnode_get_attrs ((GXmlXNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_get (_tmp2_, name);
	_tmp4_ = (GXmlDomNode*) _tmp3_;
	_g_object_unref0 (_tmp2_);
	p = _tmp4_;
	_tmp5_ = p;
	if (_tmp5_ == NULL) {
		result = NULL;
		_g_object_unref0 (p);
		return result;
	}
	_tmp6_ = p;
	_tmp7_ = gxml_xnode_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, GXML_TYPE_XNODE, GXmlXNode));
	_tmp8_ = _tmp7_;
	result = _tmp8_;
	_g_object_unref0 (p);
	return result;
}

static gchar*
gxml_xelement_real_get_attribute_ns (GXmlDomElement* base,
                                     const gchar* namespace,
                                     const gchar* local_name)
{
	GXmlXElement * self;
	GXmlDomNode* p = NULL;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNode* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* result;
	self = (GXmlXElement*) base;
	g_return_val_if_fail (local_name != NULL, NULL);
	_tmp0_ = gxml_xelement_get_ns_attr (self, local_name, namespace);
	p = _tmp0_;
	_tmp1_ = p;
	if (_tmp1_ == NULL) {
		result = NULL;
		_g_object_unref0 (p);
		return result;
	}
	_tmp2_ = p;
	_tmp3_ = gxml_xnode_get_value (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, GXML_TYPE_XNODE, GXmlXNode));
	_tmp4_ = _tmp3_;
	result = _tmp4_;
	_g_object_unref0 (p);
	return result;
}

static void
gxml_xelement_real_set_attribute (GXmlDomElement* base,
                                  const gchar* name,
                                  const gchar* value,
                                  GError** error)
{
	GXmlXElement * self;
	self = (GXmlXElement*) base;
	g_return_if_fail (name != NULL);
	g_return_if_fail (value != NULL);
	gxml_xelement_set_attr (self, name, value);
}

static void
gxml_xelement_real_set_attribute_ns (GXmlDomElement* base,
                                     const gchar* namespace,
                                     const gchar* name,
                                     const gchar* value,
                                     GError** error)
{
	GXmlXElement * self;
	self = (GXmlXElement*) base;
	g_return_if_fail (name != NULL);
	g_return_if_fail (value != NULL);
	gxml_xelement_set_ns_attr (self, namespace, name, value);
}

static void
gxml_xelement_real_remove_attribute (GXmlDomElement* base,
                                     const gchar* name)
{
	GXmlXElement * self;
	self = (GXmlXElement*) base;
	g_return_if_fail (name != NULL);
	gxml_xelement_remove_attr (self, name);
}

static void
gxml_xelement_real_remove_attribute_ns (GXmlDomElement* base,
                                        const gchar* namespace,
                                        const gchar* local_name)
{
	GXmlXElement * self;
	self = (GXmlXElement*) base;
	g_return_if_fail (local_name != NULL);
	gxml_xelement_remove_ns_attr (self, local_name, namespace);
}

static gboolean
gxml_xelement_real_has_attribute (GXmlDomElement* base,
                                  const gchar* name)
{
	GXmlXElement * self;
	GeeMap* _tmp0_;
	GeeMap* _tmp1_;
	GeeMap* _tmp2_;
	gboolean _tmp3_;
	gboolean result;
	self = (GXmlXElement*) base;
	g_return_val_if_fail (name != NULL, FALSE);
	_tmp0_ = gxml_xnode_get_attrs ((GXmlXNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_has_key (_tmp2_, name);
	_g_object_unref0 (_tmp2_);
	result = _tmp3_;
	return result;
}

static gboolean
gxml_xelement_real_has_attribute_ns (GXmlDomElement* base,
                                     const gchar* namespace,
                                     const gchar* local_name)
{
	GXmlXElement * self;
	xmlNode* _tmp0_;
	xmlAttr* attr = NULL;
	xmlNode* _tmp1_;
	xmlAttr* _tmp2_;
	xmlAttr* _tmp3_;
	gboolean result;
	self = (GXmlXElement*) base;
	g_return_val_if_fail (local_name != NULL, FALSE);
	_tmp0_ = ((GXmlXNode*) self)->_node;
	if (_tmp0_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp1_ = ((GXmlXNode*) self)->_node;
	_tmp2_ = xmlHasNsProp (_tmp1_, (xmlChar*) local_name, (xmlChar*) namespace);
	attr = _tmp2_;
	_tmp3_ = attr;
	if (_tmp3_ == NULL) {
		result = FALSE;
		return result;
	}
	result = TRUE;
	return result;
}

static GXmlDomHTMLCollection*
gxml_xelement_real_get_elements_by_tag_name (GXmlDomElement* base,
                                             const gchar* local_name)
{
	GXmlXElement * self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* result;
	self = (GXmlXElement*) base;
	g_return_val_if_fail (local_name != NULL, NULL);
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	{
		GXmlDomHTMLCollection* _n_list = NULL;
		GXmlDomHTMLCollection* _tmp1_;
		GXmlDomHTMLCollection* _tmp2_;
		gint _n_size = 0;
		GXmlDomHTMLCollection* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _n_index = 0;
		_tmp1_ = gxml_dom_parent_node_get_children ((GXmlDomParentNode*) 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_;
			GXmlDomElement* n = NULL;
			GXmlDomHTMLCollection* _tmp8_;
			gpointer _tmp9_;
			GXmlDomElement* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gboolean _tmp14_;
			GXmlHTMLCollection* _tmp17_;
			GXmlDomElement* _tmp18_;
			GXmlDomHTMLCollection* _tmp19_;
			GXmlDomHTMLCollection* _tmp20_;
			_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 = (GXmlDomElement*) _tmp9_;
			_tmp10_ = n;
			_tmp11_ = gxml_dom_node_get_node_name ((GXmlDomNode*) _tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = _tmp12_;
			_tmp14_ = g_strcmp0 (_tmp13_, local_name) == 0;
			_g_free0 (_tmp13_);
			if (_tmp14_) {
				GXmlHTMLCollection* _tmp15_;
				GXmlDomElement* _tmp16_;
				_tmp15_ = l;
				_tmp16_ = n;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
			}
			_tmp17_ = l;
			_tmp18_ = n;
			_tmp19_ = gxml_dom_element_get_elements_by_tag_name (_tmp18_, local_name);
			_tmp20_ = _tmp19_;
			gee_array_list_add_all ((GeeArrayList*) _tmp17_, (GeeCollection*) _tmp20_);
			_g_object_unref0 (_tmp20_);
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
	result = (GXmlDomHTMLCollection*) l;
	return result;
}

static GXmlDomHTMLCollection*
gxml_xelement_real_get_elements_by_tag_name_ns (GXmlDomElement* base,
                                                const gchar* namespace,
                                                const gchar* local_name)
{
	GXmlXElement * self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* result;
	self = (GXmlXElement*) base;
	g_return_val_if_fail (local_name != NULL, NULL);
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	{
		GXmlDomHTMLCollection* _n_list = NULL;
		GXmlDomHTMLCollection* _tmp1_;
		GXmlDomHTMLCollection* _tmp2_;
		gint _n_size = 0;
		GXmlDomHTMLCollection* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _n_index = 0;
		_tmp1_ = gxml_dom_parent_node_get_children ((GXmlDomParentNode*) 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_;
			GXmlDomElement* n = NULL;
			GXmlDomHTMLCollection* _tmp8_;
			gpointer _tmp9_;
			gboolean _tmp10_ = FALSE;
			GXmlDomElement* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gchar* _tmp14_;
			gboolean _tmp15_;
			GXmlHTMLCollection* _tmp22_;
			GXmlDomElement* _tmp23_;
			GXmlDomHTMLCollection* _tmp24_;
			GXmlDomHTMLCollection* _tmp25_;
			_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 = (GXmlDomElement*) _tmp9_;
			_tmp11_ = n;
			_tmp12_ = gxml_dom_node_get_node_name ((GXmlDomNode*) _tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = _tmp13_;
			_tmp15_ = g_strcmp0 (_tmp14_, local_name) == 0;
			_g_free0 (_tmp14_);
			if (_tmp15_) {
				GXmlDomElement* _tmp16_;
				gchar* _tmp17_;
				gchar* _tmp18_;
				gchar* _tmp19_;
				_tmp16_ = n;
				_tmp17_ = gxml_dom_element_get_namespace_uri (_tmp16_);
				_tmp18_ = _tmp17_;
				_tmp19_ = _tmp18_;
				_tmp10_ = g_strcmp0 (_tmp19_, namespace) == 0;
				_g_free0 (_tmp19_);
			} else {
				_tmp10_ = FALSE;
			}
			if (_tmp10_) {
				GXmlHTMLCollection* _tmp20_;
				GXmlDomElement* _tmp21_;
				_tmp20_ = l;
				_tmp21_ = n;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp20_, _tmp21_);
			}
			_tmp22_ = l;
			_tmp23_ = n;
			_tmp24_ = gxml_dom_element_get_elements_by_tag_name_ns (_tmp23_, namespace, local_name);
			_tmp25_ = _tmp24_;
			gee_array_list_add_all ((GeeArrayList*) _tmp22_, (GeeCollection*) _tmp25_);
			_g_object_unref0 (_tmp25_);
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
	result = (GXmlDomHTMLCollection*) l;
	return result;
}

static void
_vala_array_add5 (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_add6 (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_xelement_real_get_elements_by_class_name (GXmlDomElement* base,
                                               const gchar* class_names)
{
	GXmlXElement * self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	gchar** cs = NULL;
	gchar** _tmp1_;
	gint cs_length1;
	gint _cs_size_;
	GXmlDomHTMLCollection* result;
	self = (GXmlXElement*) 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_add5 (&cs, &cs_length1, &_cs_size_, _tmp4_);
	}
	{
		GXmlDomHTMLCollection* _n_list = NULL;
		GXmlDomHTMLCollection* _tmp5_;
		GXmlDomHTMLCollection* _tmp6_;
		gint _n_size = 0;
		GXmlDomHTMLCollection* _tmp7_;
		gint _tmp8_;
		gint _tmp9_;
		gint _n_index = 0;
		_tmp5_ = gxml_dom_parent_node_get_children ((GXmlDomParentNode*) 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_;
			GXmlDomElement* n = NULL;
			GXmlDomHTMLCollection* _tmp12_;
			gpointer _tmp13_;
			gchar* cls = NULL;
			GXmlDomElement* _tmp14_;
			gchar* _tmp15_;
			const gchar* _tmp16_;
			GXmlHTMLCollection* _tmp39_;
			GXmlDomElement* _tmp40_;
			GXmlDomHTMLCollection* _tmp41_;
			GXmlDomHTMLCollection* _tmp42_;
			_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 = (GXmlDomElement*) _tmp13_;
			_tmp14_ = n;
			_tmp15_ = gxml_dom_element_get_attribute (_tmp14_, "class");
			cls = _tmp15_;
			_tmp16_ = cls;
			if (_tmp16_ != NULL) {
				gchar** ncls = NULL;
				gchar** _tmp17_;
				gint ncls_length1;
				gint _ncls_size_;
				const gchar* _tmp18_;
				gint found = 0;
				gchar** _tmp24_;
				gint _tmp24__length1;
				gchar** _tmp31_;
				gint _tmp31__length1;
				_tmp17_ = g_new0 (gchar*, 0 + 1);
				ncls = _tmp17_;
				ncls_length1 = 0;
				_ncls_size_ = ncls_length1;
				_tmp18_ = cls;
				if (string_contains (_tmp18_, " ")) {
					const gchar* _tmp19_;
					gchar** _tmp20_;
					gchar** _tmp21_;
					_tmp19_ = cls;
					_tmp21_ = _tmp20_ = g_strsplit (_tmp19_, " ", 0);
					ncls = (_vala_array_free (ncls, ncls_length1, (GDestroyNotify) g_free), NULL);
					ncls = _tmp21_;
					ncls_length1 = _vala_array_length (_tmp20_);
					_ncls_size_ = ncls_length1;
				} else {
					const gchar* _tmp22_;
					gchar* _tmp23_;
					_tmp22_ = cls;
					_tmp23_ = g_strdup (_tmp22_);
					_vala_array_add6 (&ncls, &ncls_length1, &_ncls_size_, _tmp23_);
				}
				found = 0;
				_tmp24_ = cs;
				_tmp24__length1 = cs_length1;
				{
					gchar** cl_collection = NULL;
					gint cl_collection_length1 = 0;
					gint _cl_collection_size_ = 0;
					gint cl_it = 0;
					cl_collection = _tmp24_;
					cl_collection_length1 = _tmp24__length1;
					for (cl_it = 0; cl_it < cl_collection_length1; cl_it = cl_it + 1) {
						gchar* _tmp25_;
						gchar* cl = NULL;
						_tmp25_ = g_strdup (cl_collection[cl_it]);
						cl = _tmp25_;
						{
							gchar** _tmp26_;
							gint _tmp26__length1;
							_tmp26_ = ncls;
							_tmp26__length1 = ncls_length1;
							{
								gchar** ncl_collection = NULL;
								gint ncl_collection_length1 = 0;
								gint _ncl_collection_size_ = 0;
								gint ncl_it = 0;
								ncl_collection = _tmp26_;
								ncl_collection_length1 = _tmp26__length1;
								for (ncl_it = 0; ncl_it < ncl_collection_length1; ncl_it = ncl_it + 1) {
									gchar* _tmp27_;
									gchar* ncl = NULL;
									_tmp27_ = g_strdup (ncl_collection[ncl_it]);
									ncl = _tmp27_;
									{
										const gchar* _tmp28_;
										const gchar* _tmp29_;
										_tmp28_ = cl;
										_tmp29_ = ncl;
										if (g_strcmp0 (_tmp28_, _tmp29_) == 0) {
											gint _tmp30_;
											_tmp30_ = found;
											found = _tmp30_ + 1;
										}
										_g_free0 (ncl);
									}
								}
							}
							_g_free0 (cl);
						}
					}
				}
				_tmp31_ = cs;
				_tmp31__length1 = cs_length1;
				if (found == _tmp31__length1) {
					GXmlHTMLCollection* _tmp32_;
					gint _tmp33_;
					gint _tmp34_;
					_tmp32_ = l;
					_tmp33_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp32_);
					_tmp34_ = _tmp33_;
					if (_tmp34_ == 0) {
						GXmlHTMLCollection* _tmp35_;
						GXmlDomElement* _tmp36_;
						_tmp35_ = l;
						_tmp36_ = n;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp35_, _tmp36_);
					} else {
						GXmlHTMLCollection* _tmp37_;
						GXmlDomElement* _tmp38_;
						_tmp37_ = l;
						_tmp38_ = n;
						gee_abstract_list_insert ((GeeAbstractList*) _tmp37_, 0, _tmp38_);
					}
				}
				ncls = (_vala_array_free (ncls, ncls_length1, (GDestroyNotify) g_free), NULL);
			}
			_tmp39_ = l;
			_tmp40_ = n;
			_tmp41_ = gxml_dom_element_get_elements_by_class_name (_tmp40_, class_names);
			_tmp42_ = _tmp41_;
			gee_array_list_add_all ((GeeArrayList*) _tmp39_, (GeeCollection*) _tmp42_);
			_g_object_unref0 (_tmp42_);
			_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;
}

static GXmlDomHTMLCollection*
gxml_xelement_real_get_children (GXmlDomParentNode* base)
{
	GXmlDomHTMLCollection* result;
	GXmlXElement* self;
	GXmlDomElementList* l = NULL;
	GXmlDomElementList* _tmp0_;
	self = (GXmlXElement*) base;
	_tmp0_ = gxml_dom_element_list_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_)) {
				GXmlDomElementList* _tmp11_;
				GXmlDomNode* _tmp12_;
				_tmp11_ = l;
				_tmp12_ = n;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, G_TYPE_CHECK_INSTANCE_CAST (_tmp12_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement));
			}
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
	result = (GXmlDomHTMLCollection*) l;
	return result;
}

static GXmlDomElement*
gxml_xelement_real_get_first_element_child (GXmlDomParentNode* base)
{
	GXmlDomElement* result;
	GXmlXElement* self;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	GXmlDomHTMLCollection* _tmp2_;
	gpointer _tmp3_;
	GXmlDomElement* _tmp4_;
	self = (GXmlXElement*) 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_xelement_real_get_last_element_child (GXmlDomParentNode* base)
{
	GXmlDomElement* result;
	GXmlXElement* self;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	GXmlDomHTMLCollection* _tmp2_;
	gpointer _tmp3_;
	GXmlDomElement* _tmp4_;
	self = (GXmlXElement*) 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_xelement_real_get_child_element_count (GXmlDomParentNode* base)
{
	gint result;
	GXmlXElement* self;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	GXmlDomHTMLCollection* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	self = (GXmlXElement*) 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_xelement_real_query_selector_all (GXmlDomParentNode* base,
                                       const gchar* selectors,
                                       GError** error)
{
	GXmlXElement * self;
	GXmlCssSelectorParser* cs = NULL;
	GXmlCssSelectorParser* _tmp0_;
	GXmlCssSelectorParser* _tmp1_;
	GXmlDomNodeList* _tmp2_ = NULL;
	GXmlCssSelectorParser* _tmp3_;
	GXmlDomNodeList* _tmp4_;
	GXmlDomNodeList* _tmp5_;
	GError* _inner_error0_ = NULL;
	GXmlDomNodeList* result;
	self = (GXmlXElement*) 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;
}

/**
   * {@inheritDoc}
   */
static GXmlXPathObject*
gxml_xelement_real_evaluate (GXmlXPathContext* base,
                             const gchar* expression,
                             GeeMap* resolver,
                             GError** error)
{
	GXmlXElement * self;
	GXmlXPathObject* nullobj = NULL;
	gchar* data = NULL;
	gchar* _tmp0_;
	xmlDoc* ndoc = NULL;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	xmlDoc* _tmp5_;
	GXmlXDocument* gdoc = NULL;
	xmlDoc* _tmp6_;
	GXmlXDocument* _tmp7_;
	xmlXPathContext* context = NULL;
	xmlDoc* _tmp8_;
	xmlXPathContext* _tmp9_;
	GXmlXDocument* _tmp27_;
	xmlXPathContext* _tmp28_;
	xmlXPathObject* _tmp29_;
	GXmlLXPathObject* _tmp30_;
	GError* _inner_error0_ = NULL;
	GXmlXPathObject* result;
	self = (GXmlXElement*) base;
	g_return_val_if_fail (expression != NULL, NULL);
	nullobj = NULL;
	if (!GXML_IS_DOM_NODE (self)) {
		result = nullobj;
		return result;
	}
	_tmp0_ = gxml_xnode_to_string (G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_XNODE, GXmlXNode));
	data = _tmp0_;
	_tmp1_ = data;
	_tmp2_ = data;
	_tmp3_ = strlen (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = xmlReadMemory (_tmp1_, _tmp4_, NULL, NULL, 0);
	ndoc = _tmp5_;
	_tmp6_ = ndoc;
	_tmp7_ = gxml_xdocument_new_from_doc (_tmp6_);
	gdoc = _tmp7_;
	_tmp8_ = ndoc;
	_tmp9_ = xmlXPathNewContext (_tmp8_);
	context = _tmp9_;
	if (resolver != NULL) {
		{
			GeeIterator* _prefix_it = NULL;
			GeeSet* _tmp10_;
			GeeSet* _tmp11_;
			GeeSet* _tmp12_;
			GeeIterator* _tmp13_;
			GeeIterator* _tmp14_;
			_tmp10_ = gee_map_get_keys (resolver);
			_tmp11_ = _tmp10_;
			_tmp12_ = _tmp11_;
			_tmp13_ = gee_iterable_iterator ((GeeIterable*) _tmp12_);
			_tmp14_ = _tmp13_;
			_g_object_unref0 (_tmp12_);
			_prefix_it = _tmp14_;
			while (TRUE) {
				GeeIterator* _tmp15_;
				gchar* prefix = NULL;
				GeeIterator* _tmp16_;
				gpointer _tmp17_;
				gchar* uri = NULL;
				const gchar* _tmp18_;
				gpointer _tmp19_;
				gint res = 0;
				xmlXPathContext* _tmp20_;
				const gchar* _tmp21_;
				const gchar* _tmp22_;
				_tmp15_ = _prefix_it;
				if (!gee_iterator_next (_tmp15_)) {
					break;
				}
				_tmp16_ = _prefix_it;
				_tmp17_ = gee_iterator_get (_tmp16_);
				prefix = (gchar*) _tmp17_;
				_tmp18_ = prefix;
				_tmp19_ = gee_map_get (resolver, _tmp18_);
				uri = (gchar*) _tmp19_;
				_tmp20_ = context;
				_tmp21_ = prefix;
				_tmp22_ = uri;
				res = xmlXPathRegisterNs (_tmp20_, (xmlChar*) _tmp21_, (xmlChar*) _tmp22_);
				if (res != 0) {
					gchar* _tmp23_;
					gchar* _tmp24_;
					GError* _tmp25_;
					GError* _tmp26_;
					_tmp23_ = g_strdup_printf ("%i", res);
					_tmp24_ = _tmp23_;
					_tmp25_ = g_error_new (GXML_XPATH_OBJECT_ERROR, GXML_XPATH_OBJECT_ERROR_INVALID_NAMESPACE_ERROR, _ ("invalid namespace. Code: %s"), _tmp24_);
					_tmp26_ = _tmp25_;
					_g_free0 (_tmp24_);
					_inner_error0_ = _tmp26_;
					if (_inner_error0_->domain == GXML_XPATH_OBJECT_ERROR) {
						g_propagate_error (error, _inner_error0_);
						_g_free0 (uri);
						_g_free0 (prefix);
						_g_object_unref0 (_prefix_it);
						_xmlXPathFreeContext0 (context);
						_g_object_unref0 (gdoc);
						_g_free0 (data);
						_g_object_unref0 (nullobj);
						return NULL;
					} else {
						_g_free0 (uri);
						_g_free0 (prefix);
						_g_object_unref0 (_prefix_it);
						_xmlXPathFreeContext0 (context);
						_g_object_unref0 (gdoc);
						_g_free0 (data);
						_g_object_unref0 (nullobj);
						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;
					}
				}
				_g_free0 (uri);
				_g_free0 (prefix);
			}
			_g_object_unref0 (_prefix_it);
		}
	}
	_tmp27_ = gdoc;
	_tmp28_ = context;
	_tmp29_ = xmlXPathEval ((xmlChar*) expression, _tmp28_);
	_tmp30_ = gxml_lx_path_object_new (_tmp27_, _tmp29_);
	result = (GXmlXPathObject*) _tmp30_;
	_xmlXPathFreeContext0 (context);
	_g_object_unref0 (gdoc);
	_g_free0 (data);
	_g_object_unref0 (nullobj);
	return result;
}

static void
gxml_xelement_class_init (GXmlXElementClass * klass,
                          gpointer klass_data)
{
	gxml_xelement_parent_class = g_type_class_peek_parent (klass);
	((GXmlXNodeClass *) klass)->to_string = (gchar* (*) (GXmlXNode*)) gxml_xelement_real_to_string;
	GXML_XNODE_CLASS (klass)->get_value = (gchar* (*) (GXmlXNode*)) gxml_xelement_real_get_value;
	GXML_XNODE_CLASS (klass)->set_value = (void (*) (GXmlXNode*, const gchar*)) gxml_xelement_real_set_value;
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_xelement_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gxml_xelement_set_property;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XELEMENT_VALUE_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_VALUE_PROPERTY] = g_param_spec_string ("value", "value", "value", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XELEMENT_CONTENT_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_CONTENT_PROPERTY] = g_param_spec_string ("content", "content", "content", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XELEMENT_TAG_NAME_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_TAG_NAME_PROPERTY] = g_param_spec_string ("tag-name", "tag-name", "tag-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XELEMENT_NAMESPACE_URI_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_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_XELEMENT_PREFIX_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_PREFIX_PROPERTY] = g_param_spec_string ("prefix", "prefix", "prefix", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XELEMENT_LOCAL_NAME_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_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_XELEMENT_ID_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_ID_PROPERTY] = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XELEMENT_CLASS_NAME_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_CLASS_NAME_PROPERTY] = g_param_spec_string ("class-name", "class-name", "class-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XELEMENT_CLASS_LIST_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_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_XELEMENT_ATTRIBUTES_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_ATTRIBUTES_PROPERTY] = g_param_spec_object ("attributes", "attributes", "attributes", GXML_TYPE_DOM_NAMED_NODE_MAP, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_XELEMENT_CHILDREN_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_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_XELEMENT_FIRST_ELEMENT_CHILD_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_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_XELEMENT_LAST_ELEMENT_CHILD_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_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_XELEMENT_CHILD_ELEMENT_COUNT_PROPERTY, gxml_xelement_properties[GXML_XELEMENT_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));
}

static void
gxml_xelement_gxml_dom_parent_node_interface_init (GXmlDomParentNodeIface * iface,
                                                   gpointer iface_data)
{
	gxml_xelement_gxml_dom_parent_node_parent_iface = g_type_interface_peek_parent (iface);
	iface->query_selector_all = (GXmlDomNodeList* (*) (GXmlDomParentNode*, const gchar*, GError**)) gxml_xelement_real_query_selector_all;
	iface->get_children = gxml_xelement_real_get_children;
	iface->get_first_element_child = gxml_xelement_real_get_first_element_child;
	iface->get_last_element_child = gxml_xelement_real_get_last_element_child;
	iface->get_child_element_count = gxml_xelement_real_get_child_element_count;
}

static void
gxml_xelement_gxml_dom_element_interface_init (GXmlDomElementIface * iface,
                                               gpointer iface_data)
{
	gxml_xelement_gxml_dom_element_parent_iface = g_type_interface_peek_parent (iface);
	iface->write_string = (gchar* (*) (GXmlDomElement*, GCancellable*, GError**)) gxml_xelement_real_write_string;
	iface->get_attribute = (gchar* (*) (GXmlDomElement*, const gchar*)) gxml_xelement_real_get_attribute;
	iface->get_attribute_ns = (gchar* (*) (GXmlDomElement*, const gchar*, const gchar*)) gxml_xelement_real_get_attribute_ns;
	iface->set_attribute = (void (*) (GXmlDomElement*, const gchar*, const gchar*, GError**)) gxml_xelement_real_set_attribute;
	iface->set_attribute_ns = (void (*) (GXmlDomElement*, const gchar*, const gchar*, const gchar*, GError**)) gxml_xelement_real_set_attribute_ns;
	iface->remove_attribute = (void (*) (GXmlDomElement*, const gchar*)) gxml_xelement_real_remove_attribute;
	iface->remove_attribute_ns = (void (*) (GXmlDomElement*, const gchar*, const gchar*)) gxml_xelement_real_remove_attribute_ns;
	iface->has_attribute = (gboolean (*) (GXmlDomElement*, const gchar*)) gxml_xelement_real_has_attribute;
	iface->has_attribute_ns = (gboolean (*) (GXmlDomElement*, const gchar*, const gchar*)) gxml_xelement_real_has_attribute_ns;
	iface->get_elements_by_tag_name = (GXmlDomHTMLCollection* (*) (GXmlDomElement*, const gchar*)) gxml_xelement_real_get_elements_by_tag_name;
	iface->get_elements_by_tag_name_ns = (GXmlDomHTMLCollection* (*) (GXmlDomElement*, const gchar*, const gchar*)) gxml_xelement_real_get_elements_by_tag_name_ns;
	iface->get_elements_by_class_name = (GXmlDomHTMLCollection* (*) (GXmlDomElement*, const gchar*)) gxml_xelement_real_get_elements_by_class_name;
	iface->get_tag_name = gxml_xelement_real_get_tag_name;
	iface->get_namespace_uri = gxml_xelement_real_get_namespace_uri;
	iface->get_prefix = gxml_xelement_real_get_prefix;
	iface->get_local_name = gxml_xelement_real_get_local_name;
	iface->get_id = gxml_xelement_real_get_id;
	iface->set_id = gxml_xelement_real_set_id;
	iface->get_class_name = gxml_xelement_real_get_class_name;
	iface->set_class_name = gxml_xelement_real_set_class_name;
	iface->get_class_list = gxml_xelement_real_get_class_list;
	iface->get_attributes = gxml_xelement_real_get_attributes;
}

static void
gxml_xelement_gxml_xpath_context_interface_init (GXmlXPathContextIface * iface,
                                                 gpointer iface_data)
{
	gxml_xelement_gxml_xpath_context_parent_iface = g_type_interface_peek_parent (iface);
	iface->evaluate = (GXmlXPathObject* (*) (GXmlXPathContext*, const gchar*, GeeMap*, GError**)) gxml_xelement_real_evaluate;
}

static void
gxml_xelement_instance_init (GXmlXElement * self,
                             gpointer klass)
{
}

/**
 * DOM4 Class implementing {@link GXml.DomElement} interface,
 * powered by libxml-2.0 library.
 */
static GType
gxml_xelement_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlXElementClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_xelement_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlXElement), 0, (GInstanceInitFunc) gxml_xelement_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_parent_node_info = { (GInterfaceInitFunc) gxml_xelement_gxml_dom_parent_node_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_element_info = { (GInterfaceInitFunc) gxml_xelement_gxml_dom_element_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_xpath_context_info = { (GInterfaceInitFunc) gxml_xelement_gxml_xpath_context_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_xelement_type_id;
	gxml_xelement_type_id = g_type_register_static (GXML_TYPE_XNON_DOCUMENT_CHILD_NODE, "GXmlXElement", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_xelement_type_id, GXML_TYPE_DOM_PARENT_NODE, &gxml_dom_parent_node_info);
	g_type_add_interface_static (gxml_xelement_type_id, GXML_TYPE_DOM_ELEMENT, &gxml_dom_element_info);
	g_type_add_interface_static (gxml_xelement_type_id, GXML_TYPE_XPATH_CONTEXT, &gxml_xpath_context_info);
	return gxml_xelement_type_id;
}

GType
gxml_xelement_get_type (void)
{
	static volatile gsize gxml_xelement_type_id__once = 0;
	if (g_once_init_enter (&gxml_xelement_type_id__once)) {
		GType gxml_xelement_type_id;
		gxml_xelement_type_id = gxml_xelement_get_type_once ();
		g_once_init_leave (&gxml_xelement_type_id__once, gxml_xelement_type_id);
	}
	return gxml_xelement_type_id__once;
}

static void
_vala_gxml_xelement_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	GXmlXElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_XELEMENT, GXmlXElement);
	switch (property_id) {
		case GXML_XELEMENT_VALUE_PROPERTY:
		g_value_take_string (value, gxml_xnode_get_value ((GXmlXNode*) self));
		break;
		case GXML_XELEMENT_CONTENT_PROPERTY:
		g_value_take_string (value, gxml_xelement_get_content (self));
		break;
		case GXML_XELEMENT_TAG_NAME_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_tag_name ((GXmlDomElement*) self));
		break;
		case GXML_XELEMENT_NAMESPACE_URI_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_namespace_uri ((GXmlDomElement*) self));
		break;
		case GXML_XELEMENT_PREFIX_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_prefix ((GXmlDomElement*) self));
		break;
		case GXML_XELEMENT_LOCAL_NAME_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_local_name ((GXmlDomElement*) self));
		break;
		case GXML_XELEMENT_ID_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_id ((GXmlDomElement*) self));
		break;
		case GXML_XELEMENT_CLASS_NAME_PROPERTY:
		g_value_take_string (value, gxml_dom_element_get_class_name ((GXmlDomElement*) self));
		break;
		case GXML_XELEMENT_CLASS_LIST_PROPERTY:
		g_value_take_object (value, gxml_dom_element_get_class_list ((GXmlDomElement*) self));
		break;
		case GXML_XELEMENT_ATTRIBUTES_PROPERTY:
		g_value_take_object (value, gxml_dom_element_get_attributes ((GXmlDomElement*) self));
		break;
		case GXML_XELEMENT_CHILDREN_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_children ((GXmlDomParentNode*) self));
		break;
		case GXML_XELEMENT_FIRST_ELEMENT_CHILD_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_first_element_child ((GXmlDomParentNode*) self));
		break;
		case GXML_XELEMENT_LAST_ELEMENT_CHILD_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_last_element_child ((GXmlDomParentNode*) self));
		break;
		case GXML_XELEMENT_CHILD_ELEMENT_COUNT_PROPERTY:
		g_value_set_int (value, gxml_dom_parent_node_get_child_element_count ((GXmlDomParentNode*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gxml_xelement_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	GXmlXElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_XELEMENT, GXmlXElement);
	switch (property_id) {
		case GXML_XELEMENT_VALUE_PROPERTY:
		gxml_xnode_set_value ((GXmlXNode*) self, g_value_get_string (value));
		break;
		case GXML_XELEMENT_CONTENT_PROPERTY:
		gxml_xelement_set_content (self, g_value_get_string (value));
		break;
		case GXML_XELEMENT_ID_PROPERTY:
		gxml_dom_element_set_id ((GXmlDomElement*) self, g_value_get_string (value));
		break;
		case GXML_XELEMENT_CLASS_NAME_PROPERTY:
		gxml_dom_element_set_class_name ((GXmlDomElement*) self, g_value_get_string (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;
}

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

