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

/* -*- Mode: vala; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- */
/*
 *
 * Copyright (C) 2016-2019  Daniel Espinosa <esodan@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Daniel Espinosa <esodan@gmail.com>
 */

#include "gxml/gxml.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <glib-object.h>
#include <gio/gio.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_DOCUMENT_0_PROPERTY,
	GXML_DOCUMENT_IMPLEMENTATION_PROPERTY,
	GXML_DOCUMENT_URL_PROPERTY,
	GXML_DOCUMENT_DOCUMENT_URI_PROPERTY,
	GXML_DOCUMENT_ORIGIN_PROPERTY,
	GXML_DOCUMENT_COMPAT_MODE_PROPERTY,
	GXML_DOCUMENT_CHARACTER_SET_PROPERTY,
	GXML_DOCUMENT_CONTENT_TYPE_PROPERTY,
	GXML_DOCUMENT_DOCTYPE_PROPERTY,
	GXML_DOCUMENT_DOCUMENT_ELEMENT_PROPERTY,
	GXML_DOCUMENT_CHILDREN_PROPERTY,
	GXML_DOCUMENT_FIRST_ELEMENT_CHILD_PROPERTY,
	GXML_DOCUMENT_LAST_ELEMENT_CHILD_PROPERTY,
	GXML_DOCUMENT_CHILD_ELEMENT_COUNT_PROPERTY,
	GXML_DOCUMENT_NUM_PROPERTIES
};
static GParamSpec* gxml_document_properties[GXML_DOCUMENT_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_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_param_spec_unref0(var) ((var == NULL) ? NULL : (var = (g_param_spec_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
enum  {
	GXML_IMPLEMENTATION_0_PROPERTY,
	GXML_IMPLEMENTATION_NUM_PROPERTIES
};
static GParamSpec* gxml_implementation_properties[GXML_IMPLEMENTATION_NUM_PROPERTIES];
enum  {
	GXML_DOCUMENT_TYPE_0_PROPERTY,
	GXML_DOCUMENT_TYPE_NAME_PROPERTY,
	GXML_DOCUMENT_TYPE_PUBLIC_ID_PROPERTY,
	GXML_DOCUMENT_TYPE_SYSTEM_ID_PROPERTY,
	GXML_DOCUMENT_TYPE_NUM_PROPERTIES
};
static GParamSpec* gxml_document_type_properties[GXML_DOCUMENT_TYPE_NUM_PROPERTIES];
enum  {
	GXML_DOCUMENT_FRAGMENT_0_PROPERTY,
	GXML_DOCUMENT_FRAGMENT_CHILDREN_PROPERTY,
	GXML_DOCUMENT_FRAGMENT_FIRST_ELEMENT_CHILD_PROPERTY,
	GXML_DOCUMENT_FRAGMENT_LAST_ELEMENT_CHILD_PROPERTY,
	GXML_DOCUMENT_FRAGMENT_CHILD_ELEMENT_COUNT_PROPERTY,
	GXML_DOCUMENT_FRAGMENT_NUM_PROPERTIES
};
static GParamSpec* gxml_document_fragment_properties[GXML_DOCUMENT_FRAGMENT_NUM_PROPERTIES];

static gpointer gxml_document_parent_class = NULL;
static GXmlDomParentNodeIface * gxml_document_gxml_dom_parent_node_parent_iface = NULL;
static GXmlDomNonElementParentNodeIface * gxml_document_gxml_dom_non_element_parent_node_parent_iface = NULL;
static GXmlDomDocumentIface * gxml_document_gxml_dom_document_parent_iface = NULL;
static GXmlDomXMLDocumentIface * gxml_document_gxml_dom_xml_document_parent_iface = NULL;
static gpointer gxml_implementation_parent_class = NULL;
static GXmlDomImplementationIface * gxml_implementation_gxml_dom_implementation_parent_iface = NULL;
static gpointer gxml_document_type_parent_class = NULL;
static GXmlDomChildNodeIface * gxml_document_type_gxml_dom_child_node_parent_iface = NULL;
static GXmlDomDocumentTypeIface * gxml_document_type_gxml_dom_document_type_parent_iface = NULL;
static gpointer gxml_document_fragment_parent_class = NULL;
static GXmlDomParentNodeIface * gxml_document_fragment_gxml_dom_parent_node_parent_iface = NULL;
static GXmlDomNonElementParentNodeIface * gxml_document_fragment_gxml_dom_non_element_parent_node_parent_iface = NULL;
static GXmlDomDocumentFragmentIface * gxml_document_fragment_gxml_dom_document_fragment_parent_iface = NULL;

static GXmlParser* gxml_document_real_get_xml_parser (GXmlDomDocument* base);
static void gxml_document_real_set_xml_parser (GXmlDomDocument* base,
                                        GXmlParser* parser);
static GXmlDomElement* gxml_document_real_create_element (GXmlDomDocument* base,
                                                   const gchar* local_name,
                                                   GError** error);
static GXmlDomElement* gxml_document_real_create_element_ns (GXmlDomDocument* base,
                                                      const gchar* namespace_uri,
                                                      const gchar* qualified_name,
                                                      GError** error);
static GXmlDomHTMLCollection* gxml_document_real_get_elements_by_tag_name (GXmlDomDocument* base,
                                                                    const gchar* local_name);
static GXmlDomHTMLCollection* gxml_document_real_get_elements_by_tag_name_ns (GXmlDomDocument* base,
                                                                       const gchar* ns,
                                                                       const gchar* local_name);
static GXmlDomHTMLCollection* gxml_document_real_get_elements_by_class_name (GXmlDomDocument* base,
                                                                      const gchar* class_names);
static GXmlDomDocumentFragment* gxml_document_real_create_document_fragment (GXmlDomDocument* base);
static GXmlDomText* gxml_document_real_create_text_node (GXmlDomDocument* base,
                                                  const gchar* data,
                                                  GError** error);
static GXmlDomComment* gxml_document_real_gxml_dom_document_create_comment (GXmlDomDocument* base,
                                                                     const gchar* data,
                                                                     GError** error);
static GXmlDomProcessingInstruction* gxml_document_real_create_processing_instruction (GXmlDomDocument* base,
                                                                                const gchar* target,
                                                                                const gchar* data,
                                                                                GError** error);
static GXmlDomNode* gxml_document_real_import_node (GXmlDomDocument* base,
                                             GXmlDomNode* node,
                                             gboolean deep,
                                             GError** error);
static GXmlDomNode* gxml_document_real_adopt_node (GXmlDomDocument* base,
                                            GXmlDomNode* node,
                                            GError** error);
static GXmlDomEvent* gxml_document_real_create_event (GXmlDomDocument* base,
                                               const gchar* iface,
                                               GError** error);
static GXmlDomRange* gxml_document_real_create_range (GXmlDomDocument* base);
static GXmlDomNodeIterator* gxml_document_real_create_node_iterator (GXmlDomDocument* base,
                                                              GXmlDomNode* root,
                                                              gint what_to_show);
static GXmlDomTreeWalker* gxml_document_real_create_tree_walker (GXmlDomDocument* base,
                                                          GXmlDomNode* root,
                                                          gint what_to_show);
static GXmlDomNodeList* gxml_document_real_query_selector_all (GXmlDomParentNode* base,
                                                        const gchar* selectors,
                                                        GError** error);
static GXmlDomElement* gxml_document_real_get_element_by_id (GXmlDomNonElementParentNode* base,
                                                      const gchar* element_id,
                                                      GError** error);
static GObject * gxml_document_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties);
static void gxml_document_finalize (GObject * obj);
static GType gxml_document_get_type_once (void);
static void _vala_gxml_document_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
static GXmlDomDocumentType* gxml_implementation_real_create_document_type (GXmlDomImplementation* base,
                                                                    const gchar* qualified_name,
                                                                    const gchar* public_id,
                                                                    const gchar* system_id,
                                                                    GError** error);
static GXmlDomXMLDocument* gxml_implementation_real_create_document (GXmlDomImplementation* base,
                                                              const gchar* namespace,
                                                              const gchar* qualified_name,
                                                              GXmlDomDocumentType* doctype,
                                                              GError** error);
static GXmlDomDocument* gxml_implementation_real_create_html_document (GXmlDomImplementation* base,
                                                                const gchar* title);
static GType gxml_implementation_get_type_once (void);
static void gxml_document_type_real_remove (GXmlDomChildNode* base);
static GObject * gxml_document_type_constructor (GType type,
                                          guint n_construct_properties,
                                          GObjectConstructParam * construct_properties);
static void gxml_document_type_finalize (GObject * obj);
static GType gxml_document_type_get_type_once (void);
static void _vala_gxml_document_type_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec);
static GXmlDomElement* gxml_document_fragment_real_query_selector (GXmlDomParentNode* base,
                                                            const gchar* selectors,
                                                            GError** error);
static GXmlDomNodeList* gxml_document_fragment_real_query_selector_all (GXmlDomParentNode* base,
                                                                 const gchar* selectors,
                                                                 GError** error);
static GXmlDomElement* gxml_document_fragment_real_get_element_by_id (GXmlDomNonElementParentNode* base,
                                                               const gchar* element_id,
                                                               GError** error);
static GType gxml_document_fragment_get_type_once (void);
static void _vala_gxml_document_fragment_get_property (GObject * object,
                                                guint property_id,
                                                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 GXmlDomImplementation*
gxml_document_real_get_implementation (GXmlDomDocument* base)
{
	GXmlDomImplementation* result;
	GXmlDocument* self;
	GXmlDomImplementation* _tmp0_;
	self = (GXmlDocument*) base;
	_tmp0_ = self->_implementation;
	result = _tmp0_;
	return result;
}

static const gchar*
gxml_document_real_get_url (GXmlDomDocument* base)
{
	const gchar* result;
	GXmlDocument* self;
	const gchar* _tmp0_;
	self = (GXmlDocument*) base;
	_tmp0_ = self->_url;
	result = _tmp0_;
	return result;
}

static const gchar*
gxml_document_real_get_document_uri (GXmlDomDocument* base)
{
	const gchar* result;
	GXmlDocument* self;
	const gchar* _tmp0_;
	self = (GXmlDocument*) base;
	_tmp0_ = self->_url;
	result = _tmp0_;
	return result;
}

static const gchar*
gxml_document_real_get_origin (GXmlDomDocument* base)
{
	const gchar* result;
	GXmlDocument* self;
	const gchar* _tmp0_;
	self = (GXmlDocument*) base;
	_tmp0_ = self->_origin;
	result = _tmp0_;
	return result;
}

static const gchar*
gxml_document_real_get_compat_mode (GXmlDomDocument* base)
{
	const gchar* result;
	GXmlDocument* self;
	const gchar* _tmp0_;
	self = (GXmlDocument*) base;
	_tmp0_ = self->_compat_mode;
	result = _tmp0_;
	return result;
}

static const gchar*
gxml_document_real_get_character_set (GXmlDomDocument* base)
{
	const gchar* result;
	GXmlDocument* self;
	const gchar* _tmp0_;
	self = (GXmlDocument*) base;
	_tmp0_ = self->_character_set;
	result = _tmp0_;
	return result;
}

static const gchar*
gxml_document_real_get_content_type (GXmlDomDocument* base)
{
	const gchar* result;
	GXmlDocument* self;
	const gchar* _tmp0_;
	self = (GXmlDocument*) base;
	_tmp0_ = self->_content_type;
	result = _tmp0_;
	return result;
}

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

static GXmlDomDocumentType*
gxml_document_real_get_doctype (GXmlDomDocument* base)
{
	GXmlDomDocumentType* result;
	GXmlDocument* self;
	self = (GXmlDocument*) base;
	{
		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_DOCUMENT_TYPE (_tmp9_)) {
				GXmlDomNode* _tmp10_;
				GXmlDomDocumentType* _tmp11_;
				_tmp10_ = n;
				_tmp11_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, GXML_TYPE_DOM_DOCUMENT_TYPE, GXmlDomDocumentType));
				result = _tmp11_;
				_g_object_unref0 (n);
				_g_object_unref0 (_n_list);
				return result;
			}
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
	result = NULL;
	return result;
}

static GXmlDomElement*
gxml_document_real_get_document_element (GXmlDomDocument* base)
{
	GXmlDomElement* result;
	GXmlDocument* self;
	self = (GXmlDocument*) 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_;
				GXmlDomNode* _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_ = gxml_dom_node_list_get_length (_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_ = gxml_dom_node_list_item (_tmp10_, i);
				_tmp12_ = _tmp11_;
				_g_object_unref0 (_tmp10_);
				n = _tmp12_;
				_tmp13_ = n;
				if (GXML_IS_DOM_ELEMENT (_tmp13_)) {
					GXmlDomNode* _tmp14_;
					GXmlDomElement* _tmp15_;
					_tmp14_ = n;
					_tmp15_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement));
					result = _tmp15_;
					_g_object_unref0 (n);
					return result;
				}
				_g_object_unref0 (n);
			}
		}
	}
	result = NULL;
	return result;
}

GXmlDocument*
gxml_document_construct (GType object_type)
{
	GXmlDocument * self = NULL;
	self = (GXmlDocument*) gxml_node_construct (object_type);
	return self;
}

GXmlDocument*
gxml_document_new (void)
{
	return gxml_document_construct (GXML_TYPE_DOCUMENT);
}

GXmlDocument*
gxml_document_construct_from_path (GType object_type,
                                   const gchar* path,
                                   GError** error)
{
	GXmlDocument * self = NULL;
	GFile* file = NULL;
	GFile* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = g_file_new_for_path (path);
	file = _tmp0_;
	self = (GXmlDocument*) gxml_document_construct_from_file (object_type, file, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (file);
		_g_object_unref0 (self);
		return NULL;
	}
	_g_object_unref0 (file);
	return self;
}

GXmlDocument*
gxml_document_new_from_path (const gchar* path,
                             GError** error)
{
	return gxml_document_construct_from_path (GXML_TYPE_DOCUMENT, path, error);
}

/**
   * Creates a document parsing a URI file.
   */
GXmlDocument*
gxml_document_construct_from_uri (GType object_type,
                                  const gchar* uri,
                                  GError** error)
{
	GXmlDocument * self = NULL;
	GFile* _tmp0_;
	GFile* _tmp1_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (uri != NULL, NULL);
	_tmp0_ = g_file_new_for_uri (uri);
	_tmp1_ = _tmp0_;
	self = (GXmlDocument*) gxml_document_construct_from_file (object_type, _tmp1_, &_inner_error0_);
	_g_object_unref0 (_tmp1_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (self);
		return NULL;
	}
	return self;
}

GXmlDocument*
gxml_document_new_from_uri (const gchar* uri,
                            GError** error)
{
	return gxml_document_construct_from_uri (GXML_TYPE_DOCUMENT, uri, error);
}

/**
   * Creates a document parsing a file.
   */
GXmlDocument*
gxml_document_construct_from_file (GType object_type,
                                   GFile* file,
                                   GError** error)
{
	GXmlDocument * self = NULL;
	GXmlParser* parser = NULL;
	GXmlParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (file != NULL, NULL);
	self = (GXmlDocument*) gxml_node_construct (object_type);
	_tmp0_ = gxml_dom_document_get_xml_parser ((GXmlDomDocument*) self);
	parser = _tmp0_;
	gxml_parser_read_file (parser, file, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		_g_object_unref0 (self);
		return NULL;
	}
	_g_object_unref0 (parser);
	return self;
}

GXmlDocument*
gxml_document_new_from_file (GFile* file,
                             GError** error)
{
	return gxml_document_construct_from_file (GXML_TYPE_DOCUMENT, file, error);
}

/**
   * Search, instantiate and append the element marked as root,
   * with the nick equal to '::ROOT' (without ').
   */
static gpointer
_g_param_spec_ref0 (gpointer self)
{
	return self ? g_param_spec_ref (self) : NULL;
}

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

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

GXmlElement*
gxml_document_search_root_element_property (GXmlDocument* self)
{
	GObject* obj = NULL;
	GObjectClass* _tmp0_;
	guint _tmp1_ = 0;
	GParamSpec** _tmp2_;
	GObject* _tmp36_;
	GXmlElement* _tmp37_;
	GError* _inner_error0_ = NULL;
	GXmlElement* result;
	g_return_val_if_fail (self != NULL, NULL);
	obj = NULL;
	_tmp0_ = G_OBJECT_GET_CLASS ((GObject*) self);
	_tmp2_ = g_object_class_list_properties (_tmp0_, &_tmp1_);
	{
		GParamSpec** spec_collection = NULL;
		gint spec_collection_length1 = 0;
		gint _spec_collection_size_ = 0;
		gint spec_it = 0;
		spec_collection = _tmp2_;
		spec_collection_length1 = _tmp1_;
		for (spec_it = 0; spec_it < spec_collection_length1; spec_it = spec_it + 1) {
			GParamSpec* _tmp3_;
			GParamSpec* spec = NULL;
			_tmp3_ = _g_param_spec_ref0 (spec_collection[spec_it]);
			spec = _tmp3_;
			{
				GParamSpec* _tmp4_;
				const gchar* _tmp5_;
				_tmp4_ = spec;
				_tmp5_ = g_param_spec_get_nick (_tmp4_);
				if (string_contains (_tmp5_, "::")) {
					gchar* name = NULL;
					GParamSpec* _tmp6_;
					const gchar* _tmp7_;
					gchar* _tmp8_;
					gchar* _tmp9_;
					gchar* _tmp10_;
					gchar* _tmp11_;
					const gchar* _tmp12_;
					GParamSpec* _tmp13_;
					_tmp6_ = spec;
					_tmp7_ = g_param_spec_get_nick (_tmp6_);
					_tmp8_ = g_utf8_strdown (_tmp7_, (gssize) -1);
					_tmp9_ = _tmp8_;
					_tmp10_ = string_replace (_tmp9_, "::", "");
					_tmp11_ = _tmp10_;
					_g_free0 (_tmp9_);
					name = _tmp11_;
					_tmp12_ = name;
					if (g_strcmp0 (_tmp12_, "root") != 0) {
						_g_free0 (name);
						_g_param_spec_unref0 (spec);
						continue;
					}
					_tmp13_ = spec;
					if (g_type_is_a (_tmp13_->value_type, GXML_TYPE_ELEMENT)) {
						GValue val = {0};
						GValue _tmp14_ = {0};
						GParamSpec* _tmp15_;
						const gchar* _tmp16_;
						GObject* _tmp17_;
						GObject* _tmp18_;
						GObject* _tmp19_;
						g_value_init (&_tmp14_, G_TYPE_OBJECT);
						val = _tmp14_;
						_tmp15_ = spec;
						_tmp16_ = _tmp15_->name;
						g_object_get_property ((GObject*) self, _tmp16_, &val);
						_tmp17_ = g_value_get_object (&val);
						_tmp18_ = _g_object_ref0 ((GObject*) (GXML_IS_ELEMENT (_tmp17_) ? ((GXmlElement*) _tmp17_) : NULL));
						_g_object_unref0 (obj);
						obj = _tmp18_;
						_tmp19_ = obj;
						if (_tmp19_ == NULL) {
							GParamSpec* _tmp20_;
							GXmlDomDocument* _tmp21_;
							GXmlDomDocument* _tmp22_;
							GObject* _tmp23_;
							GObject* _tmp24_;
							GObject* _tmp32_;
							GParamSpec* _tmp33_;
							const gchar* _tmp34_;
							GValue _tmp35_;
							_tmp20_ = spec;
							_tmp21_ = gxml_dom_node_get_owner_document ((GXmlDomNode*) self);
							_tmp22_ = _tmp21_;
							_tmp23_ = g_object_new (_tmp20_->value_type, "owner-document", _tmp22_, NULL);
							_tmp24_ = G_IS_INITIALLY_UNOWNED (_tmp23_) ? g_object_ref_sink (_tmp23_) : _tmp23_;
							_g_object_unref0 (obj);
							obj = _tmp24_;
							{
								GObject* _tmp25_;
								GXmlDomNode* _tmp26_;
								GXmlDomNode* _tmp27_;
								_tmp25_ = obj;
								_tmp26_ = gxml_dom_node_append_child ((GXmlDomNode*) self, (GXmlDomNode*) (GXML_IS_ELEMENT (_tmp25_) ? ((GXmlElement*) _tmp25_) : NULL), &_inner_error0_);
								_tmp27_ = _tmp26_;
								_g_object_unref0 (_tmp27_);
								if (G_UNLIKELY (_inner_error0_ != NULL)) {
									goto __catch0_g_error;
								}
							}
							goto __finally0;
							__catch0_g_error:
							{
								GError* e = NULL;
								GError* _tmp28_;
								const gchar* _tmp29_;
								gchar* _tmp30_;
								gchar* _tmp31_;
								e = _inner_error0_;
								_inner_error0_ = NULL;
								_tmp28_ = e;
								_tmp29_ = _tmp28_->message;
								_tmp30_ = g_strdup_printf (_ ("Error while attempting to instantiate root property object: %s"), _tmp29_);
								_tmp31_ = _tmp30_;
								g_warning ("Document.vala:129: %s", _tmp31_);
								_g_free0 (_tmp31_);
								_g_object_unref0 (obj);
								obj = NULL;
								_g_error_free0 (e);
							}
							__finally0:
							if (G_UNLIKELY (_inner_error0_ != NULL)) {
								G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
								_g_free0 (name);
								_g_param_spec_unref0 (spec);
								spec_collection = (g_free (spec_collection), NULL);
								_g_object_unref0 (obj);
								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;
							}
							_tmp32_ = obj;
							g_value_set_object (&val, _tmp32_);
							_tmp33_ = spec;
							_tmp34_ = _tmp33_->name;
							_tmp35_ = val;
							g_object_set_property ((GObject*) self, _tmp34_, &_tmp35_);
						}
						G_IS_VALUE (&val) ? (g_value_unset (&val), NULL) : NULL;
					}
					_g_free0 (name);
				}
				_g_param_spec_unref0 (spec);
			}
		}
		spec_collection = (g_free (spec_collection), NULL);
	}
	_tmp36_ = obj;
	_tmp37_ = _g_object_ref0 (GXML_IS_ELEMENT (_tmp36_) ? ((GXmlElement*) _tmp36_) : NULL);
	result = _tmp37_;
	_g_object_unref0 (obj);
	return result;
}

/**
   * Creates a document parsing a stream.
   */
GXmlDocument*
gxml_document_construct_from_stream (GType object_type,
                                     GInputStream* stream,
                                     GError** error)
{
	GXmlDocument * self = NULL;
	GXmlParser* parser = NULL;
	GXmlParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (stream != NULL, NULL);
	self = (GXmlDocument*) gxml_node_construct (object_type);
	_tmp0_ = gxml_dom_document_get_xml_parser ((GXmlDomDocument*) self);
	parser = _tmp0_;
	gxml_parser_read_stream (parser, stream, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		_g_object_unref0 (self);
		return NULL;
	}
	_g_object_unref0 (parser);
	return self;
}

GXmlDocument*
gxml_document_new_from_stream (GInputStream* stream,
                               GError** error)
{
	return gxml_document_construct_from_stream (GXML_TYPE_DOCUMENT, stream, error);
}

/**
   * Creates a document parsing a string.
   */
GXmlDocument*
gxml_document_construct_from_string (GType object_type,
                                     const gchar* str,
                                     GError** error)
{
	GXmlDocument * self = NULL;
	GXmlParser* parser = NULL;
	GXmlParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (str != NULL, NULL);
	self = (GXmlDocument*) gxml_node_construct (object_type);
	_tmp0_ = gxml_dom_document_get_xml_parser ((GXmlDomDocument*) self);
	parser = _tmp0_;
	gxml_parser_read_string (parser, str, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		_g_object_unref0 (self);
		return NULL;
	}
	_g_object_unref0 (parser);
	return self;
}

GXmlDocument*
gxml_document_new_from_string (const gchar* str,
                               GError** error)
{
	return gxml_document_construct_from_string (GXML_TYPE_DOCUMENT, str, error);
}

static GXmlParser*
gxml_document_real_get_xml_parser (GXmlDomDocument* base)
{
	GXmlDocument * self;
	GXmlElement* roote = NULL;
	GXmlElement* _tmp0_;
	GXmlParser* parser = NULL;
	GXmlElement* _tmp1_;
	GXmlParser* _tmp5_;
	GXmlParser* result;
	self = (GXmlDocument*) base;
	_tmp0_ = gxml_document_search_root_element_property (self);
	roote = _tmp0_;
	parser = NULL;
	_tmp1_ = roote;
	if (_tmp1_ != NULL) {
		GXmlElement* _tmp2_;
		GXmlXParser* _tmp3_;
		_tmp2_ = roote;
		_tmp3_ = gxml_xparser_new ((GXmlDomNode*) _tmp2_);
		_g_object_unref0 (parser);
		parser = (GXmlParser*) _tmp3_;
	} else {
		GXmlXParser* _tmp4_;
		_tmp4_ = gxml_xparser_new ((GXmlDomNode*) self);
		_g_object_unref0 (parser);
		parser = (GXmlParser*) _tmp4_;
	}
	_tmp5_ = self->_parser;
	if (_tmp5_ != NULL) {
		GXmlParser* _tmp6_;
		GXmlParser* _tmp7_;
		gboolean _tmp8_;
		gboolean _tmp9_;
		GXmlParser* _tmp10_;
		GXmlParser* _tmp11_;
		gboolean _tmp12_;
		gboolean _tmp13_;
		GXmlParser* _tmp14_;
		GXmlParser* _tmp15_;
		GCancellable* _tmp16_;
		GCancellable* _tmp17_;
		_tmp6_ = parser;
		_tmp7_ = self->_parser;
		_tmp8_ = gxml_parser_get_backup (_tmp7_);
		_tmp9_ = _tmp8_;
		gxml_parser_set_backup (_tmp6_, _tmp9_);
		_tmp10_ = parser;
		_tmp11_ = self->_parser;
		_tmp12_ = gxml_parser_get_indent (_tmp11_);
		_tmp13_ = _tmp12_;
		gxml_parser_set_indent (_tmp10_, _tmp13_);
		_tmp14_ = parser;
		_tmp15_ = self->_parser;
		_tmp16_ = gxml_parser_get_cancellable (_tmp15_);
		_tmp17_ = _tmp16_;
		gxml_parser_set_cancellable (_tmp14_, _tmp17_);
	}
	result = parser;
	_g_object_unref0 (roote);
	return result;
}

static void
gxml_document_real_set_xml_parser (GXmlDomDocument* base,
                                   GXmlParser* parser)
{
	GXmlDocument * self;
	GXmlParser* _tmp0_;
	self = (GXmlDocument*) base;
	g_return_if_fail (parser != NULL);
	_tmp0_ = _g_object_ref0 (parser);
	_g_object_unref0 (self->_parser);
	self->_parser = _tmp0_;
}

static GXmlDomElement*
gxml_document_real_create_element (GXmlDomDocument* base,
                                   const gchar* local_name,
                                   GError** error)
{
	GXmlDocument * self;
	GXmlElement* e = NULL;
	GXmlElement* _tmp0_;
	GXmlDomElement* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (local_name != NULL, NULL);
	_tmp0_ = gxml_element_new ();
	e = _tmp0_;
	gxml_element_initialize_document (e, (GXmlDomDocument*) self, local_name);
	result = (GXmlDomElement*) e;
	return result;
}

static GXmlDomElement*
gxml_document_real_create_element_ns (GXmlDomDocument* base,
                                      const gchar* namespace_uri,
                                      const gchar* qualified_name,
                                      GError** error)
{
	GXmlDocument * self;
	gchar* n = NULL;
	gchar* _tmp0_;
	gchar* nsp = NULL;
	gboolean _tmp12_ = FALSE;
	const gchar* _tmp13_;
	gboolean _tmp15_ = FALSE;
	gboolean _tmp16_ = FALSE;
	const gchar* _tmp17_;
	gboolean _tmp20_ = FALSE;
	gboolean _tmp21_ = FALSE;
	const gchar* _tmp22_;
	GXmlElement* e = NULL;
	GXmlElement* _tmp25_;
	GXmlElement* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	GError* _inner_error0_ = NULL;
	GXmlDomElement* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (qualified_name != NULL, NULL);
	_tmp0_ = g_strdup ("");
	n = _tmp0_;
	nsp = NULL;
	if (string_contains (qualified_name, ":")) {
		gchar** s = NULL;
		gchar** _tmp1_;
		gchar** _tmp2_;
		gint s_length1;
		gint _s_size_;
		gchar** _tmp3_;
		gint _tmp3__length1;
		gchar** _tmp5_;
		gint _tmp5__length1;
		const gchar* _tmp6_;
		gchar* _tmp7_;
		gchar** _tmp8_;
		gint _tmp8__length1;
		const gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp2_ = _tmp1_ = g_strsplit (qualified_name, ":", 0);
		s = _tmp2_;
		s_length1 = _vala_array_length (_tmp1_);
		_s_size_ = s_length1;
		_tmp3_ = s;
		_tmp3__length1 = s_length1;
		if (_tmp3__length1 != 2) {
			GError* _tmp4_;
			_tmp4_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Creating a namespaced element with invalid node name"));
			_inner_error0_ = _tmp4_;
			g_propagate_error (error, _inner_error0_);
			s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (nsp);
			_g_free0 (n);
			return NULL;
		}
		_tmp5_ = s;
		_tmp5__length1 = s_length1;
		_tmp6_ = _tmp5_[0];
		_tmp7_ = g_strdup (_tmp6_);
		_g_free0 (nsp);
		nsp = _tmp7_;
		_tmp8_ = s;
		_tmp8__length1 = s_length1;
		_tmp9_ = _tmp8_[1];
		_tmp10_ = g_strdup (_tmp9_);
		_g_free0 (n);
		n = _tmp10_;
		s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
	} else {
		gchar* _tmp11_;
		_tmp11_ = g_strdup (qualified_name);
		_g_free0 (n);
		n = _tmp11_;
	}
	_tmp13_ = nsp;
	if (g_strcmp0 (_tmp13_, "") == 0) {
		_tmp12_ = namespace_uri == NULL;
	} else {
		_tmp12_ = FALSE;
	}
	if (_tmp12_) {
		GError* _tmp14_;
		_tmp14_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Creating a namespaced element with invalid namespace"));
		_inner_error0_ = _tmp14_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (nsp);
		_g_free0 (n);
		return NULL;
	}
	_tmp17_ = n;
	if (g_strcmp0 (_tmp17_, "xmlns") == 0) {
		_tmp16_ = TRUE;
	} else {
		const gchar* _tmp18_;
		_tmp18_ = nsp;
		_tmp16_ = g_strcmp0 (_tmp18_, "xmlns") == 0;
	}
	if (_tmp16_) {
		_tmp15_ = g_strcmp0 (namespace_uri, "http://www.w3.org/2000/xmlns/") != 0;
	} else {
		_tmp15_ = FALSE;
	}
	if (_tmp15_) {
		GError* _tmp19_;
		_tmp19_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Invalid namespace URI for xmlns prefix. Use http://www.w3.org/2000/xml" \
"ns/"));
		_inner_error0_ = _tmp19_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (nsp);
		_g_free0 (n);
		return NULL;
	}
	_tmp22_ = n;
	if (g_strcmp0 (_tmp22_, "xmlns") != 0) {
		_tmp21_ = TRUE;
	} else {
		const gchar* _tmp23_;
		_tmp23_ = nsp;
		_tmp21_ = g_strcmp0 (_tmp23_, "xmlns") != 0;
	}
	if (_tmp21_) {
		_tmp20_ = g_strcmp0 (namespace_uri, "http://www.w3.org/2000/xmlns/") == 0;
	} else {
		_tmp20_ = FALSE;
	}
	if (_tmp20_) {
		GError* _tmp24_;
		_tmp24_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NAMESPACE_ERROR, _ ("Only xmlns prefixs can be used with http://www.w3.org/2000/xmlns/"));
		_inner_error0_ = _tmp24_;
		g_propagate_error (error, _inner_error0_);
		_g_free0 (nsp);
		_g_free0 (n);
		return NULL;
	}
	_tmp25_ = gxml_element_new ();
	e = _tmp25_;
	_tmp26_ = e;
	_tmp27_ = nsp;
	_tmp28_ = n;
	gxml_element_initialize_document_with_namespace (_tmp26_, (GXmlDomDocument*) self, namespace_uri, _tmp27_, _tmp28_);
	result = (GXmlDomElement*) e;
	_g_free0 (nsp);
	_g_free0 (n);
	return result;
}

static GXmlDomHTMLCollection*
gxml_document_real_get_elements_by_tag_name (GXmlDomDocument* base,
                                             const gchar* local_name)
{
	GXmlDocument * self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	GXmlDomElement* _tmp1_;
	GXmlDomElement* _tmp2_;
	GXmlDomElement* _tmp3_;
	gboolean _tmp4_;
	GXmlHTMLCollection* _tmp5_;
	GXmlDomElement* _tmp6_;
	GXmlDomElement* _tmp7_;
	GXmlDomElement* _tmp8_;
	GXmlDomHTMLCollection* _tmp9_;
	GXmlDomHTMLCollection* _tmp10_;
	GXmlDomHTMLCollection* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (local_name != NULL, NULL);
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	_tmp1_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_ == NULL;
	_g_object_unref0 (_tmp3_);
	if (_tmp4_) {
		result = (GXmlDomHTMLCollection*) l;
		return result;
	}
	_tmp5_ = l;
	_tmp6_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	_tmp9_ = gxml_dom_element_get_elements_by_tag_name (_tmp8_, local_name);
	_tmp10_ = _tmp9_;
	gee_array_list_add_all ((GeeArrayList*) _tmp5_, (GeeCollection*) _tmp10_);
	_g_object_unref0 (_tmp10_);
	_g_object_unref0 (_tmp8_);
	result = (GXmlDomHTMLCollection*) l;
	return result;
}

static GXmlDomHTMLCollection*
gxml_document_real_get_elements_by_tag_name_ns (GXmlDomDocument* base,
                                                const gchar* ns,
                                                const gchar* local_name)
{
	GXmlDocument * self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	GXmlDomElement* _tmp1_;
	GXmlDomElement* _tmp2_;
	GXmlDomElement* _tmp3_;
	gboolean _tmp4_;
	GXmlHTMLCollection* _tmp5_;
	GXmlDomElement* _tmp6_;
	GXmlDomElement* _tmp7_;
	GXmlDomElement* _tmp8_;
	GXmlDomHTMLCollection* _tmp9_;
	GXmlDomHTMLCollection* _tmp10_;
	GXmlDomHTMLCollection* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (local_name != NULL, NULL);
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	_tmp1_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_ == NULL;
	_g_object_unref0 (_tmp3_);
	if (_tmp4_) {
		result = (GXmlDomHTMLCollection*) l;
		return result;
	}
	_tmp5_ = l;
	_tmp6_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	_tmp9_ = gxml_dom_element_get_elements_by_tag_name_ns (_tmp8_, ns, local_name);
	_tmp10_ = _tmp9_;
	gee_array_list_add_all ((GeeArrayList*) _tmp5_, (GeeCollection*) _tmp10_);
	_g_object_unref0 (_tmp10_);
	_g_object_unref0 (_tmp8_);
	result = (GXmlDomHTMLCollection*) l;
	return result;
}

static GXmlDomHTMLCollection*
gxml_document_real_get_elements_by_class_name (GXmlDomDocument* base,
                                               const gchar* class_names)
{
	GXmlDocument * self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	GXmlDomElement* _tmp1_;
	GXmlDomElement* _tmp2_;
	GXmlDomElement* _tmp3_;
	gboolean _tmp4_;
	GXmlHTMLCollection* _tmp5_;
	GXmlDomElement* _tmp6_;
	GXmlDomElement* _tmp7_;
	GXmlDomElement* _tmp8_;
	GXmlDomHTMLCollection* _tmp9_;
	GXmlDomHTMLCollection* _tmp10_;
	GXmlDomHTMLCollection* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (class_names != NULL, NULL);
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	_tmp1_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_ == NULL;
	_g_object_unref0 (_tmp3_);
	if (_tmp4_) {
		result = (GXmlDomHTMLCollection*) l;
		return result;
	}
	_tmp5_ = l;
	_tmp6_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
	_tmp7_ = _tmp6_;
	_tmp8_ = _tmp7_;
	_tmp9_ = gxml_dom_element_get_elements_by_class_name (_tmp8_, class_names);
	_tmp10_ = _tmp9_;
	gee_array_list_add_all ((GeeArrayList*) _tmp5_, (GeeCollection*) _tmp10_);
	_g_object_unref0 (_tmp10_);
	_g_object_unref0 (_tmp8_);
	result = (GXmlDomHTMLCollection*) l;
	return result;
}

static GXmlDomDocumentFragment*
gxml_document_real_create_document_fragment (GXmlDomDocument* base)
{
	GXmlDocument * self;
	GXmlDocumentFragment* _tmp0_;
	GXmlDomDocumentFragment* result;
	self = (GXmlDocument*) base;
	_tmp0_ = gxml_document_fragment_new ((GXmlDomDocument*) self);
	result = (GXmlDomDocumentFragment*) _tmp0_;
	return result;
}

static GXmlDomText*
gxml_document_real_create_text_node (GXmlDomDocument* base,
                                     const gchar* data,
                                     GError** error)
{
	GXmlDocument * self;
	GXmlText* _tmp0_;
	GXmlDomText* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (data != NULL, NULL);
	_tmp0_ = gxml_text_new ((GXmlDomDocument*) self, data);
	result = (GXmlDomText*) _tmp0_;
	return result;
}

static GXmlDomComment*
gxml_document_real_gxml_dom_document_create_comment (GXmlDomDocument* base,
                                                     const gchar* data,
                                                     GError** error)
{
	GXmlDocument * self;
	GXmlComment* _tmp0_;
	GXmlDomComment* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (data != NULL, NULL);
	_tmp0_ = gxml_comment_new ((GXmlDomDocument*) self, data);
	result = (GXmlDomComment*) _tmp0_;
	return result;
}

static GXmlDomProcessingInstruction*
gxml_document_real_create_processing_instruction (GXmlDomDocument* base,
                                                  const gchar* target,
                                                  const gchar* data,
                                                  GError** error)
{
	GXmlDocument * self;
	GXmlProcessingInstruction* _tmp0_;
	GXmlDomProcessingInstruction* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (target != NULL, NULL);
	g_return_val_if_fail (data != NULL, NULL);
	_tmp0_ = gxml_processing_instruction_new ((GXmlDomDocument*) self, target, data);
	result = (GXmlDomProcessingInstruction*) _tmp0_;
	return result;
}

static GXmlDomNode*
gxml_document_real_import_node (GXmlDomDocument* base,
                                GXmlDomNode* node,
                                gboolean deep,
                                GError** error)
{
	GXmlDocument * self;
	gboolean _tmp1_ = FALSE;
	GXmlDomNode* dst = NULL;
	GXmlDomNode* _tmp45_;
	GXmlDomNode* _tmp52_;
	GError* _inner_error0_ = NULL;
	GXmlDomNode* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (node != NULL, NULL);
	if (GXML_IS_DOM_DOCUMENT (node)) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NOT_SUPPORTED_ERROR, _ ("Can't import a Document"));
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (!GXML_IS_DOM_ELEMENT (node)) {
		GXmlDomElement* _tmp2_;
		GXmlDomElement* _tmp3_;
		GXmlDomElement* _tmp4_;
		_tmp2_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
		_tmp3_ = _tmp2_;
		_tmp4_ = _tmp3_;
		_tmp1_ = _tmp4_ == NULL;
		_g_object_unref0 (_tmp4_);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GError* _tmp5_;
		_tmp5_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_HIERARCHY_REQUEST_ERROR, _ ("Can't import a non Element type node to a Document"));
		_inner_error0_ = _tmp5_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	dst = NULL;
	if (GXML_IS_DOM_ELEMENT (node)) {
		GXmlDomElement* _tmp6_ = NULL;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		GXmlDomElement* _tmp10_;
		GXmlDomElement* _tmp11_;
		GXmlDomElement* _tmp12_;
		GXmlDomNode* _tmp13_;
		GXmlDomElement* _tmp14_;
		GXmlDomElement* _tmp15_;
		GXmlDomElement* _tmp16_;
		gboolean _tmp17_;
		_tmp7_ = gxml_dom_node_get_node_name (node);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_;
		_tmp10_ = gxml_dom_document_create_element (G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_DOM_DOCUMENT, GXmlDomDocument), _tmp9_, &_inner_error0_);
		_tmp11_ = _tmp10_;
		_g_free0 (_tmp9_);
		_tmp6_ = _tmp11_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (dst);
			return NULL;
		}
		_tmp12_ = _tmp6_;
		_tmp6_ = NULL;
		_g_object_unref0 (dst);
		dst = (GXmlDomNode*) _tmp12_;
		_tmp13_ = dst;
		gxml_dom_node_copy ((GXmlDomDocument*) self, _tmp13_, node, deep, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (_tmp6_);
			_g_object_unref0 (dst);
			return NULL;
		}
		_tmp14_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
		_tmp15_ = _tmp14_;
		_tmp16_ = _tmp15_;
		_tmp17_ = _tmp16_ == NULL;
		_g_object_unref0 (_tmp16_);
		if (_tmp17_) {
			GXmlDomNode* _tmp18_;
			GXmlDomNode* _tmp19_;
			GXmlDomNode* _tmp20_;
			_tmp18_ = dst;
			_tmp19_ = gxml_dom_node_append_child ((GXmlDomNode*) self, _tmp18_, &_inner_error0_);
			_tmp20_ = _tmp19_;
			_g_object_unref0 (_tmp20_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_propagate_error (error, _inner_error0_);
				_g_object_unref0 (_tmp6_);
				_g_object_unref0 (dst);
				return NULL;
			}
			result = dst;
			_g_object_unref0 (_tmp6_);
			return result;
		}
		_g_object_unref0 (_tmp6_);
	}
	if (GXML_IS_DOM_TEXT (node)) {
		GXmlDomText* _tmp21_ = NULL;
		gchar* _tmp22_;
		gchar* _tmp23_;
		gchar* _tmp24_;
		GXmlDomText* _tmp25_;
		GXmlDomText* _tmp26_;
		GXmlDomText* _tmp27_;
		_tmp22_ = gxml_dom_character_data_get_data ((GXmlDomCharacterData*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_DOM_TEXT, GXmlDomText));
		_tmp23_ = _tmp22_;
		_tmp24_ = _tmp23_;
		_tmp25_ = gxml_dom_document_create_text_node ((GXmlDomDocument*) self, _tmp24_, &_inner_error0_);
		_tmp26_ = _tmp25_;
		_g_free0 (_tmp24_);
		_tmp21_ = _tmp26_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (dst);
			return NULL;
		}
		_tmp27_ = _tmp21_;
		_tmp21_ = NULL;
		_g_object_unref0 (dst);
		dst = (GXmlDomNode*) _tmp27_;
		_g_object_unref0 (_tmp21_);
	}
	if (GXML_IS_DOM_COMMENT (node)) {
		GXmlDomComment* _tmp28_ = NULL;
		gchar* _tmp29_;
		gchar* _tmp30_;
		gchar* _tmp31_;
		GXmlDomComment* _tmp32_;
		GXmlDomComment* _tmp33_;
		GXmlDomComment* _tmp34_;
		_tmp29_ = gxml_dom_character_data_get_data ((GXmlDomCharacterData*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_DOM_COMMENT, GXmlDomComment));
		_tmp30_ = _tmp29_;
		_tmp31_ = _tmp30_;
		_tmp32_ = gxml_dom_document_create_comment (G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_DOM_DOCUMENT, GXmlDomDocument), _tmp31_, &_inner_error0_);
		_tmp33_ = _tmp32_;
		_g_free0 (_tmp31_);
		_tmp28_ = _tmp33_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (dst);
			return NULL;
		}
		_tmp34_ = _tmp28_;
		_tmp28_ = NULL;
		_g_object_unref0 (dst);
		dst = (GXmlDomNode*) _tmp34_;
		_g_object_unref0 (_tmp28_);
	}
	if (GXML_IS_DOM_PROCESSING_INSTRUCTION (node)) {
		GXmlDomProcessingInstruction* _tmp35_ = NULL;
		gchar* _tmp36_;
		gchar* _tmp37_;
		gchar* _tmp38_;
		gchar* _tmp39_;
		gchar* _tmp40_;
		gchar* _tmp41_;
		GXmlDomProcessingInstruction* _tmp42_;
		GXmlDomProcessingInstruction* _tmp43_;
		GXmlDomProcessingInstruction* _tmp44_;
		_tmp36_ = gxml_dom_processing_instruction_get_target (G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_DOM_PROCESSING_INSTRUCTION, GXmlDomProcessingInstruction));
		_tmp37_ = _tmp36_;
		_tmp38_ = _tmp37_;
		_tmp39_ = gxml_dom_character_data_get_data ((GXmlDomCharacterData*) G_TYPE_CHECK_INSTANCE_CAST (node, GXML_TYPE_DOM_PROCESSING_INSTRUCTION, GXmlDomProcessingInstruction));
		_tmp40_ = _tmp39_;
		_tmp41_ = _tmp40_;
		_tmp42_ = gxml_dom_document_create_processing_instruction ((GXmlDomDocument*) self, _tmp38_, _tmp41_, &_inner_error0_);
		_tmp43_ = _tmp42_;
		_g_free0 (_tmp41_);
		_g_free0 (_tmp38_);
		_tmp35_ = _tmp43_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (dst);
			return NULL;
		}
		_tmp44_ = _tmp35_;
		_tmp35_ = NULL;
		_g_object_unref0 (dst);
		dst = (GXmlDomNode*) _tmp44_;
		_g_object_unref0 (_tmp35_);
	}
	_tmp45_ = dst;
	if (_tmp45_ != NULL) {
		GXmlDomElement* _tmp46_;
		GXmlDomElement* _tmp47_;
		GXmlDomElement* _tmp48_;
		GXmlDomNode* _tmp49_;
		GXmlDomNode* _tmp50_;
		GXmlDomNode* _tmp51_;
		_tmp46_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
		_tmp47_ = _tmp46_;
		_tmp48_ = _tmp47_;
		_tmp49_ = dst;
		_tmp50_ = gxml_dom_node_append_child ((GXmlDomNode*) _tmp48_, GXML_IS_DOM_NODE (_tmp49_) ? ((GXmlDomNode*) _tmp49_) : NULL, &_inner_error0_);
		_tmp51_ = _tmp50_;
		_g_object_unref0 (_tmp51_);
		_g_object_unref0 (_tmp48_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (dst);
			return NULL;
		}
		result = dst;
		return result;
	}
	_tmp52_ = _g_object_ref0 (node);
	result = _tmp52_;
	_g_object_unref0 (dst);
	return result;
}

static GXmlDomNode*
gxml_document_real_adopt_node (GXmlDomDocument* base,
                               GXmlDomNode* node,
                               GError** error)
{
	GXmlDocument * self;
	GXmlDomDocument* _tmp1_;
	GXmlDomDocument* _tmp2_;
	GXmlDomElement* dst = NULL;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	GXmlDomElement* _tmp7_;
	GXmlDomElement* _tmp8_;
	GXmlDomElement* _tmp9_;
	GXmlDomNode* _tmp10_;
	GXmlDomNode* _tmp11_;
	GXmlDomNode* _tmp12_;
	gboolean _tmp13_;
	GXmlDomElement* _tmp28_;
	GXmlDomElement* _tmp29_;
	GXmlDomElement* _tmp30_;
	gboolean _tmp31_;
	GXmlDomElement* _tmp41_;
	GXmlDomNode* _tmp42_;
	GError* _inner_error0_ = NULL;
	GXmlDomNode* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (node != NULL, NULL);
	if (GXML_IS_DOM_DOCUMENT (node)) {
		GError* _tmp0_;
		_tmp0_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_NOT_SUPPORTED_ERROR, _ ("Can't adopt a Document"));
		_inner_error0_ = _tmp0_;
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp1_ = gxml_dom_node_get_owner_document (node);
	_tmp2_ = _tmp1_;
	if (G_TYPE_CHECK_INSTANCE_CAST (self, GXML_TYPE_DOM_DOCUMENT, GXmlDomDocument) == _tmp2_) {
		GXmlDomNode* _tmp3_;
		_tmp3_ = _g_object_ref0 (node);
		result = _tmp3_;
		return result;
	}
	_tmp4_ = gxml_dom_node_get_node_name (node);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp7_ = gxml_dom_document_create_element ((GXmlDomDocument*) self, _tmp6_, &_inner_error0_);
	_tmp8_ = _tmp7_;
	_g_free0 (_tmp6_);
	dst = _tmp8_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	_tmp9_ = dst;
	gxml_dom_node_copy ((GXmlDomDocument*) self, (GXmlDomNode*) _tmp9_, node, TRUE, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (dst);
		return NULL;
	}
	_tmp10_ = gxml_dom_node_get_parent_node (node);
	_tmp11_ = _tmp10_;
	_tmp12_ = _tmp11_;
	_tmp13_ = _tmp12_ != NULL;
	_g_object_unref0 (_tmp12_);
	if (_tmp13_) {
		GXmlDomNode* _tmp14_;
		GXmlDomNode* _tmp15_;
		GXmlDomNode* _tmp16_;
		GXmlDomNodeList* _tmp17_;
		GXmlDomNodeList* _tmp18_;
		GXmlDomNodeList* _tmp19_;
		GXmlDomNode* _tmp20_;
		GXmlDomNode* _tmp21_;
		GXmlDomNode* _tmp22_;
		GXmlDomNodeList* _tmp23_;
		GXmlDomNodeList* _tmp24_;
		GXmlDomNodeList* _tmp25_;
		gpointer _tmp26_;
		GXmlDomNode* _tmp27_;
		_tmp14_ = gxml_dom_node_get_parent_node (node);
		_tmp15_ = _tmp14_;
		_tmp16_ = _tmp15_;
		_tmp17_ = gxml_dom_node_get_child_nodes (_tmp16_);
		_tmp18_ = _tmp17_;
		_tmp19_ = _tmp18_;
		_tmp20_ = gxml_dom_node_get_parent_node (node);
		_tmp21_ = _tmp20_;
		_tmp22_ = _tmp21_;
		_tmp23_ = gxml_dom_node_get_child_nodes (_tmp22_);
		_tmp24_ = _tmp23_;
		_tmp25_ = _tmp24_;
		_tmp26_ = gee_list_remove_at ((GeeList*) _tmp19_, gee_list_index_of ((GeeList*) _tmp25_, node));
		_tmp27_ = (GXmlDomNode*) _tmp26_;
		_g_object_unref0 (_tmp27_);
		_g_object_unref0 (_tmp25_);
		_g_object_unref0 (_tmp22_);
		_g_object_unref0 (_tmp19_);
		_g_object_unref0 (_tmp16_);
	}
	_tmp28_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
	_tmp29_ = _tmp28_;
	_tmp30_ = _tmp29_;
	_tmp31_ = _tmp30_ == NULL;
	_g_object_unref0 (_tmp30_);
	if (_tmp31_) {
		GXmlDomElement* _tmp32_;
		GXmlDomNode* _tmp33_;
		GXmlDomNode* _tmp34_;
		_tmp32_ = dst;
		_tmp33_ = gxml_dom_node_append_child ((GXmlDomNode*) self, GXML_IS_DOM_NODE (_tmp32_) ? ((GXmlDomNode*) _tmp32_) : NULL, &_inner_error0_);
		_tmp34_ = _tmp33_;
		_g_object_unref0 (_tmp34_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (dst);
			return NULL;
		}
	} else {
		GXmlDomElement* _tmp35_;
		GXmlDomElement* _tmp36_;
		GXmlDomElement* _tmp37_;
		GXmlDomElement* _tmp38_;
		GXmlDomNode* _tmp39_;
		GXmlDomNode* _tmp40_;
		_tmp35_ = gxml_dom_document_get_document_element ((GXmlDomDocument*) self);
		_tmp36_ = _tmp35_;
		_tmp37_ = _tmp36_;
		_tmp38_ = dst;
		_tmp39_ = gxml_dom_node_append_child ((GXmlDomNode*) _tmp37_, GXML_IS_DOM_NODE (_tmp38_) ? ((GXmlDomNode*) _tmp38_) : NULL, &_inner_error0_);
		_tmp40_ = _tmp39_;
		_g_object_unref0 (_tmp40_);
		_g_object_unref0 (_tmp37_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (dst);
			return NULL;
		}
	}
	_tmp41_ = dst;
	_tmp42_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp41_, GXML_TYPE_DOM_NODE, GXmlDomNode));
	result = _tmp42_;
	_g_object_unref0 (dst);
	return result;
}

static GXmlDomEvent*
gxml_document_real_create_event (GXmlDomDocument* base,
                                 const gchar* iface,
                                 GError** error)
{
	GXmlDocument * self;
	gchar* s = NULL;
	gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp3_;
	const gchar* _tmp5_;
	const gchar* _tmp7_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	const gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	GXmlDomEvent* _tmp17_;
	GXmlDomEvent* _tmp18_;
	GXmlDomEvent* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (iface != NULL, NULL);
	_tmp0_ = g_utf8_strdown (iface, (gssize) -1);
	s = _tmp0_;
	_tmp1_ = s;
	if (g_strcmp0 (_tmp1_, "customevent") == 0) {
		GXmlCustomEvent* _tmp2_;
		_tmp2_ = gxml_custom_event_new ();
		_g_object_unref0 (self->_constructor);
		self->_constructor = (GXmlDomEvent*) _tmp2_;
	}
	_tmp3_ = s;
	if (g_strcmp0 (_tmp3_, "event") == 0) {
		GXmlCustomEvent* _tmp4_;
		_tmp4_ = gxml_custom_event_new ();
		_g_object_unref0 (self->_constructor);
		self->_constructor = (GXmlDomEvent*) _tmp4_;
	}
	_tmp5_ = s;
	if (g_strcmp0 (_tmp5_, "events") == 0) {
		GXmlCustomEvent* _tmp6_;
		_tmp6_ = gxml_custom_event_new ();
		_g_object_unref0 (self->_constructor);
		self->_constructor = (GXmlDomEvent*) _tmp6_;
	}
	_tmp7_ = s;
	if (g_strcmp0 (_tmp7_, "htmlevents") == 0) {
		GXmlCustomEvent* _tmp8_;
		_tmp8_ = gxml_custom_event_new ();
		_g_object_unref0 (self->_constructor);
		self->_constructor = (GXmlDomEvent*) _tmp8_;
	}
	_tmp9_ = s;
	if (g_strcmp0 (_tmp9_, "keyboardevent") == 0) {
		_g_object_unref0 (self->_constructor);
		self->_constructor = NULL;
	}
	_tmp10_ = s;
	if (g_strcmp0 (_tmp10_, "keyevents") == 0) {
		_g_object_unref0 (self->_constructor);
		self->_constructor = NULL;
	}
	_tmp11_ = s;
	if (g_strcmp0 (_tmp11_, "messageevent") == 0) {
		_g_object_unref0 (self->_constructor);
		self->_constructor = NULL;
	}
	_tmp12_ = s;
	if (g_strcmp0 (_tmp12_, "mouseevent") == 0) {
		_g_object_unref0 (self->_constructor);
		self->_constructor = NULL;
	}
	_tmp13_ = s;
	if (g_strcmp0 (_tmp13_, "mouseevents") == 0) {
		_g_object_unref0 (self->_constructor);
		self->_constructor = NULL;
	}
	_tmp14_ = s;
	if (g_strcmp0 (_tmp14_, "touchevent") == 0) {
		_g_object_unref0 (self->_constructor);
		self->_constructor = NULL;
	}
	_tmp15_ = s;
	if (g_strcmp0 (_tmp15_, "uievent") == 0) {
		_g_object_unref0 (self->_constructor);
		self->_constructor = NULL;
	}
	_tmp16_ = s;
	if (g_strcmp0 (_tmp16_, "uievents") == 0) {
		_g_object_unref0 (self->_constructor);
		self->_constructor = NULL;
	}
	_tmp17_ = self->_constructor;
	_tmp18_ = _g_object_ref0 (_tmp17_);
	result = _tmp18_;
	_g_free0 (s);
	return result;
}

static GXmlDomRange*
gxml_document_real_create_range (GXmlDomDocument* base)
{
	GXmlDocument * self;
	GXmlRange* _tmp0_;
	GXmlDomRange* result;
	self = (GXmlDocument*) base;
	_tmp0_ = gxml_range_new ((GXmlDomDocument*) self);
	result = (GXmlDomRange*) _tmp0_;
	return result;
}

static GXmlDomNodeIterator*
gxml_document_real_create_node_iterator (GXmlDomDocument* base,
                                         GXmlDomNode* root,
                                         gint what_to_show)
{
	GXmlDocument * self;
	GXmlNodeIterator* _tmp0_;
	GXmlDomNodeIterator* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (root != NULL, NULL);
	_tmp0_ = gxml_node_iterator_new (root, what_to_show);
	result = (GXmlDomNodeIterator*) _tmp0_;
	return result;
}

static GXmlDomTreeWalker*
gxml_document_real_create_tree_walker (GXmlDomDocument* base,
                                       GXmlDomNode* root,
                                       gint what_to_show)
{
	GXmlDocument * self;
	GXmlTreeWalker* _tmp0_;
	GXmlDomTreeWalker* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (root != NULL, NULL);
	_tmp0_ = gxml_tree_walker_new (root, what_to_show);
	result = (GXmlDomTreeWalker*) _tmp0_;
	return result;
}

static GXmlDomHTMLCollection*
gxml_document_real_get_children (GXmlDomParentNode* base)
{
	GXmlDomHTMLCollection* result;
	GXmlDocument* self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	self = (GXmlDocument*) base;
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	{
		GXmlDomNodeList* _n_list = NULL;
		GXmlDomNodeList* _tmp1_;
		GXmlDomNodeList* _tmp2_;
		gint _n_size = 0;
		GXmlDomNodeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _n_index = 0;
		_tmp1_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp2_ = _tmp1_;
		_n_list = _tmp2_;
		_tmp3_ = _n_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_n_size = _tmp5_;
		_n_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			GXmlDomNode* n = NULL;
			GXmlDomNodeList* _tmp8_;
			gpointer _tmp9_;
			GXmlDomNode* _tmp10_;
			_n_index = _n_index + 1;
			_tmp6_ = _n_index;
			_tmp7_ = _n_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _n_list;
			_tmp9_ = gee_list_get ((GeeList*) _tmp8_, _n_index);
			n = (GXmlDomNode*) _tmp9_;
			_tmp10_ = n;
			if (GXML_IS_DOM_ELEMENT (_tmp10_)) {
				GXmlHTMLCollection* _tmp11_;
				GXmlDomNode* _tmp12_;
				_tmp11_ = l;
				_tmp12_ = n;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, 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_document_real_get_first_element_child (GXmlDomParentNode* base)
{
	GXmlDomElement* result;
	GXmlDocument* self;
	GXmlDomNodeList* _tmp0_;
	GXmlDomNodeList* _tmp1_;
	GXmlDomNodeList* _tmp2_;
	gpointer _tmp3_;
	GXmlDomElement* _tmp4_;
	self = (GXmlDocument*) base;
	_tmp0_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_list_first ((GeeList*) _tmp2_);
	_tmp4_ = G_TYPE_CHECK_INSTANCE_CAST ((GXmlDomNode*) _tmp3_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement);
	_g_object_unref0 (_tmp2_);
	result = _tmp4_;
	return result;
}

static GXmlDomElement*
gxml_document_real_get_last_element_child (GXmlDomParentNode* base)
{
	GXmlDomElement* result;
	GXmlDocument* self;
	GXmlDomNodeList* _tmp0_;
	GXmlDomNodeList* _tmp1_;
	GXmlDomNodeList* _tmp2_;
	gpointer _tmp3_;
	GXmlDomElement* _tmp4_;
	self = (GXmlDocument*) base;
	_tmp0_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_list_last ((GeeList*) _tmp2_);
	_tmp4_ = G_TYPE_CHECK_INSTANCE_CAST ((GXmlDomNode*) _tmp3_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement);
	_g_object_unref0 (_tmp2_);
	result = _tmp4_;
	return result;
}

static gint
gxml_document_real_get_child_element_count (GXmlDomParentNode* base)
{
	gint result;
	GXmlDocument* self;
	GXmlDomNodeList* _tmp0_;
	GXmlDomNodeList* _tmp1_;
	GXmlDomNodeList* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	self = (GXmlDocument*) 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_;
	_g_object_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}

static GXmlDomNodeList*
gxml_document_real_query_selector_all (GXmlDomParentNode* base,
                                       const gchar* selectors,
                                       GError** error)
{
	GXmlDocument * self;
	GXmlCssSelectorParser* cs = NULL;
	GXmlCssSelectorParser* _tmp0_;
	GXmlCssSelectorParser* _tmp1_;
	GXmlNodeList* l = NULL;
	GXmlNodeList* _tmp2_;
	GError* _inner_error0_ = NULL;
	GXmlDomNodeList* result;
	self = (GXmlDocument*) 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;
	}
	_tmp2_ = gxml_node_list_new ();
	l = _tmp2_;
	{
		GXmlDomNodeList* _e_list = NULL;
		GXmlDomNodeList* _tmp3_;
		GXmlDomNodeList* _tmp4_;
		gint _e_size = 0;
		GXmlDomNodeList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _e_index = 0;
		_tmp3_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp4_ = _tmp3_;
		_e_list = _tmp4_;
		_tmp5_ = _e_list;
		_tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_e_size = _tmp7_;
		_e_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			GXmlDomNode* e = NULL;
			GXmlDomNodeList* _tmp10_;
			gpointer _tmp11_;
			GXmlDomNode* _tmp12_;
			gboolean _tmp13_ = FALSE;
			GXmlCssSelectorParser* _tmp14_;
			GXmlDomNode* _tmp15_;
			GXmlDomNodeList* _tmp18_ = NULL;
			GXmlCssSelectorParser* _tmp19_;
			GXmlDomNode* _tmp20_;
			GXmlDomNodeList* _tmp21_;
			GXmlNodeList* _tmp22_;
			_e_index = _e_index + 1;
			_tmp8_ = _e_index;
			_tmp9_ = _e_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _e_list;
			_tmp11_ = gee_list_get ((GeeList*) _tmp10_, _e_index);
			e = (GXmlDomNode*) _tmp11_;
			_tmp12_ = e;
			if (!GXML_IS_DOM_ELEMENT (_tmp12_)) {
				_g_object_unref0 (e);
				continue;
			}
			_tmp14_ = cs;
			_tmp15_ = e;
			_tmp13_ = gxml_css_selector_parser_match (_tmp14_, GXML_IS_DOM_ELEMENT (_tmp15_) ? ((GXmlDomElement*) _tmp15_) : NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_propagate_error (error, _inner_error0_);
				_g_object_unref0 (e);
				_g_object_unref0 (_e_list);
				_g_object_unref0 (l);
				_g_object_unref0 (cs);
				return NULL;
			}
			if (_tmp13_) {
				GXmlNodeList* _tmp16_;
				GXmlDomNode* _tmp17_;
				_tmp16_ = l;
				_tmp17_ = e;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
			}
			_tmp19_ = cs;
			_tmp20_ = e;
			_tmp21_ = gxml_css_selector_parser_query_selector_all (_tmp19_, GXML_IS_DOM_ELEMENT (_tmp20_) ? ((GXmlDomElement*) _tmp20_) : NULL, &_inner_error0_);
			_tmp18_ = _tmp21_;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_propagate_error (error, _inner_error0_);
				_g_object_unref0 (e);
				_g_object_unref0 (_e_list);
				_g_object_unref0 (l);
				_g_object_unref0 (cs);
				return NULL;
			}
			_tmp22_ = l;
			gee_array_list_add_all ((GeeArrayList*) _tmp22_, (GeeCollection*) _tmp18_);
			_g_object_unref0 (_tmp18_);
			_g_object_unref0 (e);
		}
		_g_object_unref0 (_e_list);
	}
	result = (GXmlDomNodeList*) l;
	_g_object_unref0 (cs);
	return result;
}

static GXmlDomElement*
gxml_document_real_get_element_by_id (GXmlDomNonElementParentNode* base,
                                      const gchar* element_id,
                                      GError** error)
{
	GXmlDocument * self;
	GXmlDomElementList* l = NULL;
	GXmlDomElementList* _tmp0_;
	GXmlDomElementList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	GXmlDomElementList* _tmp4_;
	GXmlDomElement* _tmp5_;
	GXmlDomElement* _tmp6_;
	GXmlDomElement* result;
	self = (GXmlDocument*) base;
	g_return_val_if_fail (element_id != NULL, NULL);
	_tmp0_ = gxml_dom_parent_node_get_elements_by_property_value ((GXmlDomParentNode*) self, "id", element_id);
	l = _tmp0_;
	_tmp1_ = l;
	_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == 0) {
		result = NULL;
		_g_object_unref0 (l);
		return result;
	}
	_tmp4_ = l;
	_tmp5_ = gxml_dom_html_collection_get_element ((GXmlDomHTMLCollection*) _tmp4_, 0);
	_tmp6_ = GXML_IS_DOM_ELEMENT (_tmp5_) ? ((GXmlDomElement*) _tmp5_) : NULL;
	if (_tmp6_ == NULL) {
		_g_object_unref0 (_tmp5_);
	}
	result = _tmp6_;
	_g_object_unref0 (l);
	return result;
}

static GObject *
gxml_document_constructor (GType type,
                           guint n_construct_properties,
                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GXmlDocument * self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	parent_class = G_OBJECT_CLASS (gxml_document_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_DOCUMENT, GXmlDocument);
	_tmp0_ = g_strdup ("#document");
	_g_free0 (((GXmlNode*) self)->_local_name);
	((GXmlNode*) self)->_local_name = _tmp0_;
	((GXmlNode*) self)->_node_type = GXML_DOM_NODE_NODE_TYPE_DOCUMENT_NODE;
	_tmp1_ = g_strdup ("about:blank");
	_g_free0 (self->_url);
	self->_url = _tmp1_;
	_tmp2_ = g_strdup ("");
	_g_free0 (self->_origin);
	self->_origin = _tmp2_;
	_tmp3_ = g_strdup ("");
	_g_free0 (self->_compat_mode);
	self->_compat_mode = _tmp3_;
	_tmp4_ = g_strdup ("utf-8");
	_g_free0 (self->_character_set);
	self->_character_set = _tmp4_;
	_tmp5_ = g_strdup ("application/xml");
	_g_free0 (self->_content_type);
	self->_content_type = _tmp5_;
	_g_object_unref0 (self->_parser);
	self->_parser = NULL;
	return obj;
}

static void
gxml_document_class_init (GXmlDocumentClass * klass,
                          gpointer klass_data)
{
	gxml_document_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_document_get_property;
	G_OBJECT_CLASS (klass)->constructor = gxml_document_constructor;
	G_OBJECT_CLASS (klass)->finalize = gxml_document_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_IMPLEMENTATION_PROPERTY, gxml_document_properties[GXML_DOCUMENT_IMPLEMENTATION_PROPERTY] = g_param_spec_object ("implementation", "implementation", "implementation", GXML_TYPE_DOM_IMPLEMENTATION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_URL_PROPERTY, gxml_document_properties[GXML_DOCUMENT_URL_PROPERTY] = g_param_spec_string ("url", "url", "url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_DOCUMENT_URI_PROPERTY, gxml_document_properties[GXML_DOCUMENT_DOCUMENT_URI_PROPERTY] = g_param_spec_string ("document-uri", "document-uri", "document-uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_ORIGIN_PROPERTY, gxml_document_properties[GXML_DOCUMENT_ORIGIN_PROPERTY] = g_param_spec_string ("origin", "origin", "origin", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_COMPAT_MODE_PROPERTY, gxml_document_properties[GXML_DOCUMENT_COMPAT_MODE_PROPERTY] = g_param_spec_string ("compat-mode", "compat-mode", "compat-mode", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_CHARACTER_SET_PROPERTY, gxml_document_properties[GXML_DOCUMENT_CHARACTER_SET_PROPERTY] = g_param_spec_string ("character-set", "character-set", "character-set", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_CONTENT_TYPE_PROPERTY, gxml_document_properties[GXML_DOCUMENT_CONTENT_TYPE_PROPERTY] = g_param_spec_string ("content-type", "content-type", "content-type", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_DOCTYPE_PROPERTY, gxml_document_properties[GXML_DOCUMENT_DOCTYPE_PROPERTY] = g_param_spec_object ("doctype", "doctype", "doctype", GXML_TYPE_DOM_DOCUMENT_TYPE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_DOCUMENT_ELEMENT_PROPERTY, gxml_document_properties[GXML_DOCUMENT_DOCUMENT_ELEMENT_PROPERTY] = g_param_spec_object ("document-element", "document-element", "document-element", GXML_TYPE_DOM_ELEMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_CHILDREN_PROPERTY, gxml_document_properties[GXML_DOCUMENT_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_DOCUMENT_FIRST_ELEMENT_CHILD_PROPERTY, gxml_document_properties[GXML_DOCUMENT_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_DOCUMENT_LAST_ELEMENT_CHILD_PROPERTY, gxml_document_properties[GXML_DOCUMENT_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_DOCUMENT_CHILD_ELEMENT_COUNT_PROPERTY, gxml_document_properties[GXML_DOCUMENT_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_document_gxml_dom_parent_node_interface_init (GXmlDomParentNodeIface * iface,
                                                   gpointer iface_data)
{
	gxml_document_gxml_dom_parent_node_parent_iface = g_type_interface_peek_parent (iface);
	iface->query_selector_all = (GXmlDomNodeList* (*) (GXmlDomParentNode*, const gchar*, GError**)) gxml_document_real_query_selector_all;
	iface->get_children = gxml_document_real_get_children;
	iface->get_first_element_child = gxml_document_real_get_first_element_child;
	iface->get_last_element_child = gxml_document_real_get_last_element_child;
	iface->get_child_element_count = gxml_document_real_get_child_element_count;
}

static void
gxml_document_gxml_dom_non_element_parent_node_interface_init (GXmlDomNonElementParentNodeIface * iface,
                                                               gpointer iface_data)
{
	gxml_document_gxml_dom_non_element_parent_node_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_element_by_id = (GXmlDomElement* (*) (GXmlDomNonElementParentNode*, const gchar*, GError**)) gxml_document_real_get_element_by_id;
}

static void
gxml_document_gxml_dom_document_interface_init (GXmlDomDocumentIface * iface,
                                                gpointer iface_data)
{
	gxml_document_gxml_dom_document_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_xml_parser = (GXmlParser* (*) (GXmlDomDocument*)) gxml_document_real_get_xml_parser;
	iface->set_xml_parser = (void (*) (GXmlDomDocument*, GXmlParser*)) gxml_document_real_set_xml_parser;
	iface->create_element = (GXmlDomElement* (*) (GXmlDomDocument*, const gchar*, GError**)) gxml_document_real_create_element;
	iface->create_element_ns = (GXmlDomElement* (*) (GXmlDomDocument*, const gchar*, const gchar*, GError**)) gxml_document_real_create_element_ns;
	iface->get_elements_by_tag_name = (GXmlDomHTMLCollection* (*) (GXmlDomDocument*, const gchar*)) gxml_document_real_get_elements_by_tag_name;
	iface->get_elements_by_tag_name_ns = (GXmlDomHTMLCollection* (*) (GXmlDomDocument*, const gchar*, const gchar*)) gxml_document_real_get_elements_by_tag_name_ns;
	iface->get_elements_by_class_name = (GXmlDomHTMLCollection* (*) (GXmlDomDocument*, const gchar*)) gxml_document_real_get_elements_by_class_name;
	iface->create_document_fragment = (GXmlDomDocumentFragment* (*) (GXmlDomDocument*)) gxml_document_real_create_document_fragment;
	iface->create_text_node = (GXmlDomText* (*) (GXmlDomDocument*, const gchar*, GError**)) gxml_document_real_create_text_node;
	iface->create_comment = (GXmlDomComment* (*) (GXmlDomDocument*, const gchar*, GError**)) gxml_document_real_gxml_dom_document_create_comment;
	iface->create_processing_instruction = (GXmlDomProcessingInstruction* (*) (GXmlDomDocument*, const gchar*, const gchar*, GError**)) gxml_document_real_create_processing_instruction;
	iface->import_node = (GXmlDomNode* (*) (GXmlDomDocument*, GXmlDomNode*, gboolean, GError**)) gxml_document_real_import_node;
	iface->adopt_node = (GXmlDomNode* (*) (GXmlDomDocument*, GXmlDomNode*, GError**)) gxml_document_real_adopt_node;
	iface->create_event = (GXmlDomEvent* (*) (GXmlDomDocument*, const gchar*, GError**)) gxml_document_real_create_event;
	iface->create_range = (GXmlDomRange* (*) (GXmlDomDocument*)) gxml_document_real_create_range;
	iface->create_node_iterator = (GXmlDomNodeIterator* (*) (GXmlDomDocument*, GXmlDomNode*, gint)) gxml_document_real_create_node_iterator;
	iface->create_tree_walker = (GXmlDomTreeWalker* (*) (GXmlDomDocument*, GXmlDomNode*, gint)) gxml_document_real_create_tree_walker;
	iface->get_implementation = gxml_document_real_get_implementation;
	iface->get_url = gxml_document_real_get_url;
	iface->get_document_uri = gxml_document_real_get_document_uri;
	iface->get_origin = gxml_document_real_get_origin;
	iface->get_compat_mode = gxml_document_real_get_compat_mode;
	iface->get_character_set = gxml_document_real_get_character_set;
	iface->get_content_type = gxml_document_real_get_content_type;
	iface->get_doctype = gxml_document_real_get_doctype;
	iface->get_document_element = gxml_document_real_get_document_element;
}

static void
gxml_document_gxml_dom_xml_document_interface_init (GXmlDomXMLDocumentIface * iface,
                                                    gpointer iface_data)
{
	gxml_document_gxml_dom_xml_document_parent_iface = g_type_interface_peek_parent (iface);
}

static void
gxml_document_instance_init (GXmlDocument * self,
                             gpointer klass)
{
	GXmlImplementation* _tmp0_;
	_tmp0_ = gxml_implementation_new ();
	self->_implementation = (GXmlDomImplementation*) _tmp0_;
}

static void
gxml_document_finalize (GObject * obj)
{
	GXmlDocument * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_DOCUMENT, GXmlDocument);
	_g_object_unref0 (self->_implementation);
	_g_free0 (self->_url);
	_g_free0 (self->_origin);
	_g_free0 (self->_compat_mode);
	_g_free0 (self->_character_set);
	_g_free0 (self->_content_type);
	_g_object_unref0 (self->_constructor);
	_g_object_unref0 (self->_parser);
	G_OBJECT_CLASS (gxml_document_parent_class)->finalize (obj);
}

/**
 * A DOM4 implementation of {@link DomDocument}, 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.
 *
 * If you define a property in a derived class with a nick's name '::ROOT' it
 * will be initialized and used as root node to parse documents, when you call
 * {@link DomDocument.read_from_string}, {@link DomDocument.read_from_file} or
 * the like.
 */
static GType
gxml_document_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlDocumentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_document_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlDocument), 0, (GInstanceInitFunc) gxml_document_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_parent_node_info = { (GInterfaceInitFunc) gxml_document_gxml_dom_parent_node_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_non_element_parent_node_info = { (GInterfaceInitFunc) gxml_document_gxml_dom_non_element_parent_node_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_document_info = { (GInterfaceInitFunc) gxml_document_gxml_dom_document_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_xml_document_info = { (GInterfaceInitFunc) gxml_document_gxml_dom_xml_document_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_document_type_id;
	gxml_document_type_id = g_type_register_static (GXML_TYPE_NODE, "GXmlDocument", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_document_type_id, GXML_TYPE_DOM_PARENT_NODE, &gxml_dom_parent_node_info);
	g_type_add_interface_static (gxml_document_type_id, GXML_TYPE_DOM_NON_ELEMENT_PARENT_NODE, &gxml_dom_non_element_parent_node_info);
	g_type_add_interface_static (gxml_document_type_id, GXML_TYPE_DOM_DOCUMENT, &gxml_dom_document_info);
	g_type_add_interface_static (gxml_document_type_id, GXML_TYPE_DOM_XML_DOCUMENT, &gxml_dom_xml_document_info);
	return gxml_document_type_id;
}

GType
gxml_document_get_type (void)
{
	static volatile gsize gxml_document_type_id__once = 0;
	if (g_once_init_enter (&gxml_document_type_id__once)) {
		GType gxml_document_type_id;
		gxml_document_type_id = gxml_document_get_type_once ();
		g_once_init_leave (&gxml_document_type_id__once, gxml_document_type_id);
	}
	return gxml_document_type_id__once;
}

static void
_vala_gxml_document_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	GXmlDocument * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_DOCUMENT, GXmlDocument);
	switch (property_id) {
		case GXML_DOCUMENT_IMPLEMENTATION_PROPERTY:
		g_value_set_object (value, gxml_dom_document_get_implementation ((GXmlDomDocument*) self));
		break;
		case GXML_DOCUMENT_URL_PROPERTY:
		g_value_set_string (value, gxml_dom_document_get_url ((GXmlDomDocument*) self));
		break;
		case GXML_DOCUMENT_DOCUMENT_URI_PROPERTY:
		g_value_set_string (value, gxml_dom_document_get_document_uri ((GXmlDomDocument*) self));
		break;
		case GXML_DOCUMENT_ORIGIN_PROPERTY:
		g_value_set_string (value, gxml_dom_document_get_origin ((GXmlDomDocument*) self));
		break;
		case GXML_DOCUMENT_COMPAT_MODE_PROPERTY:
		g_value_set_string (value, gxml_dom_document_get_compat_mode ((GXmlDomDocument*) self));
		break;
		case GXML_DOCUMENT_CHARACTER_SET_PROPERTY:
		g_value_set_string (value, gxml_dom_document_get_character_set ((GXmlDomDocument*) self));
		break;
		case GXML_DOCUMENT_CONTENT_TYPE_PROPERTY:
		g_value_set_string (value, gxml_dom_document_get_content_type ((GXmlDomDocument*) self));
		break;
		case GXML_DOCUMENT_DOCTYPE_PROPERTY:
		g_value_take_object (value, gxml_dom_document_get_doctype ((GXmlDomDocument*) self));
		break;
		case GXML_DOCUMENT_DOCUMENT_ELEMENT_PROPERTY:
		g_value_take_object (value, gxml_dom_document_get_document_element ((GXmlDomDocument*) self));
		break;
		case GXML_DOCUMENT_CHILDREN_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_children ((GXmlDomParentNode*) self));
		break;
		case GXML_DOCUMENT_FIRST_ELEMENT_CHILD_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_first_element_child ((GXmlDomParentNode*) self));
		break;
		case GXML_DOCUMENT_LAST_ELEMENT_CHILD_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_last_element_child ((GXmlDomParentNode*) self));
		break;
		case GXML_DOCUMENT_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 GXmlDomDocumentType*
gxml_implementation_real_create_document_type (GXmlDomImplementation* base,
                                               const gchar* qualified_name,
                                               const gchar* public_id,
                                               const gchar* system_id,
                                               GError** error)
{
	GXmlImplementation * self;
	GXmlDocument* _tmp0_;
	GXmlDocument* _tmp1_;
	GXmlDocumentType* _tmp2_;
	GXmlDomDocumentType* _tmp3_;
	GXmlDomDocumentType* result;
	self = (GXmlImplementation*) base;
	g_return_val_if_fail (qualified_name != NULL, NULL);
	g_return_val_if_fail (public_id != NULL, NULL);
	g_return_val_if_fail (system_id != NULL, NULL);
	_tmp0_ = gxml_document_new ();
	_tmp1_ = _tmp0_;
	_tmp2_ = gxml_document_type_new_with_ids ((GXmlDomDocument*) _tmp1_, qualified_name, public_id, system_id);
	_tmp3_ = (GXmlDomDocumentType*) _tmp2_;
	_g_object_unref0 (_tmp1_);
	result = _tmp3_;
	return result;
}

static GXmlDomXMLDocument*
gxml_implementation_real_create_document (GXmlDomImplementation* base,
                                          const gchar* namespace,
                                          const gchar* qualified_name,
                                          GXmlDomDocumentType* doctype,
                                          GError** error)
{
	GXmlImplementation * self;
	GXmlDocument* d = NULL;
	GXmlDocument* _tmp0_;
	GXmlDomElement* _tmp13_ = NULL;
	GXmlDocument* _tmp14_;
	GXmlDomElement* _tmp15_;
	GXmlDocument* _tmp16_;
	GXmlDomNode* _tmp17_;
	GXmlDomNode* _tmp18_;
	GXmlDocument* _tmp19_;
	GXmlDomXMLDocument* _tmp20_;
	GError* _inner_error0_ = NULL;
	GXmlDomXMLDocument* result;
	self = (GXmlImplementation*) base;
	_tmp0_ = gxml_document_new ();
	d = _tmp0_;
	if (doctype != NULL) {
		GXmlDocument* _tmp1_;
		GXmlDocument* _tmp2_;
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		const gchar* _tmp8_;
		GXmlDocumentType* _tmp9_;
		GXmlDocumentType* _tmp10_;
		GXmlDomNode* _tmp11_;
		GXmlDomNode* _tmp12_;
		_tmp1_ = d;
		_tmp2_ = d;
		_tmp3_ = gxml_dom_document_type_get_name (doctype);
		_tmp4_ = _tmp3_;
		_tmp5_ = gxml_dom_document_type_get_public_id (doctype);
		_tmp6_ = _tmp5_;
		_tmp7_ = gxml_dom_document_type_get_system_id (doctype);
		_tmp8_ = _tmp7_;
		_tmp9_ = gxml_document_type_new_with_ids ((GXmlDomDocument*) _tmp2_, _tmp4_, _tmp6_, _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = gxml_dom_node_append_child ((GXmlDomNode*) _tmp1_, (GXmlDomNode*) _tmp10_, &_inner_error0_);
		_tmp12_ = _tmp11_;
		_g_object_unref0 (_tmp12_);
		_g_object_unref0 (_tmp10_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (d);
			return NULL;
		}
	}
	_tmp14_ = d;
	_tmp15_ = gxml_dom_document_create_element_ns ((GXmlDomDocument*) _tmp14_, namespace, qualified_name, &_inner_error0_);
	_tmp13_ = _tmp15_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (d);
		return NULL;
	}
	_tmp16_ = d;
	_tmp17_ = gxml_dom_node_append_child ((GXmlDomNode*) _tmp16_, (GXmlDomNode*) _tmp13_, &_inner_error0_);
	_tmp18_ = _tmp17_;
	_g_object_unref0 (_tmp18_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (_tmp13_);
		_g_object_unref0 (d);
		return NULL;
	}
	_tmp19_ = d;
	_tmp20_ = _g_object_ref0 (GXML_IS_DOM_XML_DOCUMENT (_tmp19_) ? ((GXmlDomXMLDocument*) _tmp19_) : NULL);
	result = _tmp20_;
	_g_object_unref0 (_tmp13_);
	_g_object_unref0 (d);
	return result;
}

static GXmlDomDocument*
gxml_implementation_real_create_html_document (GXmlDomImplementation* base,
                                               const gchar* title)
{
	GXmlImplementation * self;
	GXmlXHtmlDocument* _tmp0_;
	GXmlDomDocument* result;
	self = (GXmlImplementation*) base;
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = gxml_xhtml_document_new ();
	result = (GXmlDomDocument*) _tmp0_;
	return result;
}

GXmlImplementation*
gxml_implementation_construct (GType object_type)
{
	GXmlImplementation * self = NULL;
	self = (GXmlImplementation*) g_object_new (object_type, NULL);
	return self;
}

GXmlImplementation*
gxml_implementation_new (void)
{
	return gxml_implementation_construct (GXML_TYPE_IMPLEMENTATION);
}

static void
gxml_implementation_class_init (GXmlImplementationClass * klass,
                                gpointer klass_data)
{
	gxml_implementation_parent_class = g_type_class_peek_parent (klass);
}

static void
gxml_implementation_gxml_dom_implementation_interface_init (GXmlDomImplementationIface * iface,
                                                            gpointer iface_data)
{
	gxml_implementation_gxml_dom_implementation_parent_iface = g_type_interface_peek_parent (iface);
	iface->create_document_type = (GXmlDomDocumentType* (*) (GXmlDomImplementation*, const gchar*, const gchar*, const gchar*, GError**)) gxml_implementation_real_create_document_type;
	iface->create_document = (GXmlDomXMLDocument* (*) (GXmlDomImplementation*, const gchar*, const gchar*, GXmlDomDocumentType*, GError**)) gxml_implementation_real_create_document;
	iface->create_html_document = (GXmlDomDocument* (*) (GXmlDomImplementation*, const gchar*)) gxml_implementation_real_create_html_document;
}

static void
gxml_implementation_instance_init (GXmlImplementation * self,
                                   gpointer klass)
{
}

static GType
gxml_implementation_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlImplementationClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_implementation_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlImplementation), 0, (GInstanceInitFunc) gxml_implementation_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_implementation_info = { (GInterfaceInitFunc) gxml_implementation_gxml_dom_implementation_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_implementation_type_id;
	gxml_implementation_type_id = g_type_register_static (G_TYPE_OBJECT, "GXmlImplementation", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_implementation_type_id, GXML_TYPE_DOM_IMPLEMENTATION, &gxml_dom_implementation_info);
	return gxml_implementation_type_id;
}

GType
gxml_implementation_get_type (void)
{
	static volatile gsize gxml_implementation_type_id__once = 0;
	if (g_once_init_enter (&gxml_implementation_type_id__once)) {
		GType gxml_implementation_type_id;
		gxml_implementation_type_id = gxml_implementation_get_type_once ();
		g_once_init_leave (&gxml_implementation_type_id__once, gxml_implementation_type_id);
	}
	return gxml_implementation_type_id__once;
}

static const gchar*
gxml_document_type_real_get_name (GXmlDomDocumentType* base)
{
	const gchar* result;
	GXmlDocumentType* self;
	const gchar* _tmp0_;
	self = (GXmlDocumentType*) base;
	_tmp0_ = self->_name;
	result = _tmp0_;
	return result;
}

static const gchar*
gxml_document_type_real_get_public_id (GXmlDomDocumentType* base)
{
	const gchar* result;
	GXmlDocumentType* self;
	const gchar* _tmp0_;
	self = (GXmlDocumentType*) base;
	_tmp0_ = self->_public_id;
	result = _tmp0_;
	return result;
}

static const gchar*
gxml_document_type_real_get_system_id (GXmlDomDocumentType* base)
{
	const gchar* result;
	GXmlDocumentType* self;
	const gchar* _tmp0_;
	self = (GXmlDocumentType*) base;
	_tmp0_ = self->_system_id;
	result = _tmp0_;
	return result;
}

GXmlDocumentType*
gxml_document_type_construct (GType object_type,
                              GXmlDomDocument* doc,
                              const gchar* name,
                              const gchar* public_id,
                              const gchar* system_id)
{
	GXmlDocumentType * self = NULL;
	GXmlDomDocument* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_val_if_fail (doc != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	self = (GXmlDocumentType*) gxml_node_construct (object_type);
	_tmp0_ = _g_object_ref0 (doc);
	_g_object_unref0 (((GXmlNode*) self)->_document);
	((GXmlNode*) self)->_document = _tmp0_;
	_tmp1_ = g_strdup (name);
	_g_free0 (self->_name);
	self->_name = _tmp1_;
	_tmp2_ = g_strdup (public_id);
	_g_free0 (self->_public_id);
	self->_public_id = _tmp2_;
	_tmp3_ = g_strdup (system_id);
	_g_free0 (self->_system_id);
	self->_system_id = _tmp3_;
	return self;
}

GXmlDocumentType*
gxml_document_type_new (GXmlDomDocument* doc,
                        const gchar* name,
                        const gchar* public_id,
                        const gchar* system_id)
{
	return gxml_document_type_construct (GXML_TYPE_DOCUMENT_TYPE, doc, name, public_id, system_id);
}

GXmlDocumentType*
gxml_document_type_construct_with_name (GType object_type,
                                        GXmlDomDocument* doc,
                                        const gchar* name)
{
	GXmlDocumentType * self = NULL;
	GXmlDomDocument* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_val_if_fail (doc != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	self = (GXmlDocumentType*) gxml_node_construct (object_type);
	_tmp0_ = _g_object_ref0 (doc);
	_g_object_unref0 (((GXmlNode*) self)->_document);
	((GXmlNode*) self)->_document = _tmp0_;
	_tmp1_ = g_strdup (name);
	_g_free0 (self->_name);
	self->_name = _tmp1_;
	_tmp2_ = g_strdup ("");
	_g_free0 (self->_public_id);
	self->_public_id = _tmp2_;
	_tmp3_ = g_strdup ("");
	_g_free0 (self->_system_id);
	self->_system_id = _tmp3_;
	return self;
}

GXmlDocumentType*
gxml_document_type_new_with_name (GXmlDomDocument* doc,
                                  const gchar* name)
{
	return gxml_document_type_construct_with_name (GXML_TYPE_DOCUMENT_TYPE, doc, name);
}

GXmlDocumentType*
gxml_document_type_construct_with_ids (GType object_type,
                                       GXmlDomDocument* doc,
                                       const gchar* name,
                                       const gchar* public_id,
                                       const gchar* system_id)
{
	GXmlDocumentType * self = NULL;
	GXmlDomDocument* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_val_if_fail (doc != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (public_id != NULL, NULL);
	g_return_val_if_fail (system_id != NULL, NULL);
	self = (GXmlDocumentType*) gxml_node_construct (object_type);
	_tmp0_ = _g_object_ref0 (doc);
	_g_object_unref0 (((GXmlNode*) self)->_document);
	((GXmlNode*) self)->_document = _tmp0_;
	_tmp1_ = g_strdup (name);
	_g_free0 (self->_name);
	self->_name = _tmp1_;
	_tmp2_ = g_strdup (public_id);
	_g_free0 (self->_public_id);
	self->_public_id = _tmp2_;
	_tmp3_ = g_strdup (system_id);
	_g_free0 (self->_system_id);
	self->_system_id = _tmp3_;
	return self;
}

GXmlDocumentType*
gxml_document_type_new_with_ids (GXmlDomDocument* doc,
                                 const gchar* name,
                                 const gchar* public_id,
                                 const gchar* system_id)
{
	return gxml_document_type_construct_with_ids (GXML_TYPE_DOCUMENT_TYPE, doc, name, public_id, system_id);
}

static void
gxml_document_type_real_remove (GXmlDomChildNode* base)
{
	GXmlDocumentType * self;
	GXmlDomNode* _tmp0_;
	GXmlDomNode* _tmp1_;
	GXmlDomNode* _tmp2_;
	gboolean _tmp3_;
	GXmlDomNode* _tmp4_;
	GXmlDomNode* _tmp5_;
	GXmlDomNode* _tmp6_;
	GXmlDomNodeList* _tmp7_;
	GXmlDomNodeList* _tmp8_;
	GXmlDomNodeList* _tmp9_;
	gboolean _tmp10_;
	gint i = 0;
	GXmlDomNode* _tmp11_;
	GXmlDomNode* _tmp12_;
	GXmlDomNode* _tmp13_;
	GXmlDomNodeList* _tmp14_;
	GXmlDomNodeList* _tmp15_;
	GXmlDomNodeList* _tmp16_;
	gint _tmp17_;
	GXmlDomNode* _tmp18_;
	GXmlDomNode* _tmp19_;
	GXmlDomNode* _tmp20_;
	GXmlDomNodeList* _tmp21_;
	GXmlDomNodeList* _tmp22_;
	GXmlDomNodeList* _tmp23_;
	gpointer _tmp24_;
	GXmlDomNode* _tmp25_;
	self = (GXmlDocumentType*) base;
	_tmp0_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_ == NULL;
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		return;
	}
	_tmp4_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp7_ = gxml_dom_node_get_child_nodes (_tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = _tmp8_;
	_tmp10_ = _tmp9_ == NULL;
	_g_object_unref0 (_tmp9_);
	_g_object_unref0 (_tmp6_);
	if (_tmp10_) {
		return;
	}
	_tmp11_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp12_ = _tmp11_;
	_tmp13_ = _tmp12_;
	_tmp14_ = gxml_dom_node_get_child_nodes (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = _tmp15_;
	_tmp17_ = gee_list_index_of ((GeeList*) _tmp16_, (GXmlDomNode*) self);
	_g_object_unref0 (_tmp16_);
	_g_object_unref0 (_tmp13_);
	i = _tmp17_;
	_tmp18_ = gxml_dom_node_get_parent_node ((GXmlDomNode*) self);
	_tmp19_ = _tmp18_;
	_tmp20_ = _tmp19_;
	_tmp21_ = gxml_dom_node_get_child_nodes (_tmp20_);
	_tmp22_ = _tmp21_;
	_tmp23_ = _tmp22_;
	_tmp24_ = gee_list_remove_at ((GeeList*) _tmp23_, i);
	_tmp25_ = (GXmlDomNode*) _tmp24_;
	_g_object_unref0 (_tmp25_);
	_g_object_unref0 (_tmp23_);
	_g_object_unref0 (_tmp20_);
}

static GObject *
gxml_document_type_constructor (GType type,
                                guint n_construct_properties,
                                GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GXmlDocumentType * self;
	gchar* _tmp0_;
	parent_class = G_OBJECT_CLASS (gxml_document_type_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_DOCUMENT_TYPE, GXmlDocumentType);
	((GXmlNode*) self)->_node_type = GXML_DOM_NODE_NODE_TYPE_DOCUMENT_TYPE_NODE;
	_tmp0_ = g_strdup ("!DOCTYPE");
	_g_free0 (((GXmlNode*) self)->_local_name);
	((GXmlNode*) self)->_local_name = _tmp0_;
	return obj;
}

static void
gxml_document_type_class_init (GXmlDocumentTypeClass * klass,
                               gpointer klass_data)
{
	gxml_document_type_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_document_type_get_property;
	G_OBJECT_CLASS (klass)->constructor = gxml_document_type_constructor;
	G_OBJECT_CLASS (klass)->finalize = gxml_document_type_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_TYPE_NAME_PROPERTY, gxml_document_type_properties[GXML_DOCUMENT_TYPE_NAME_PROPERTY] = g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_TYPE_PUBLIC_ID_PROPERTY, gxml_document_type_properties[GXML_DOCUMENT_TYPE_PUBLIC_ID_PROPERTY] = g_param_spec_string ("public-id", "public-id", "public-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_TYPE_SYSTEM_ID_PROPERTY, gxml_document_type_properties[GXML_DOCUMENT_TYPE_SYSTEM_ID_PROPERTY] = g_param_spec_string ("system-id", "system-id", "system-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gxml_document_type_gxml_dom_child_node_interface_init (GXmlDomChildNodeIface * iface,
                                                       gpointer iface_data)
{
	gxml_document_type_gxml_dom_child_node_parent_iface = g_type_interface_peek_parent (iface);
	iface->remove = (void (*) (GXmlDomChildNode*)) gxml_document_type_real_remove;
}

static void
gxml_document_type_gxml_dom_document_type_interface_init (GXmlDomDocumentTypeIface * iface,
                                                          gpointer iface_data)
{
	gxml_document_type_gxml_dom_document_type_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_name = gxml_document_type_real_get_name;
	iface->get_public_id = gxml_document_type_real_get_public_id;
	iface->get_system_id = gxml_document_type_real_get_system_id;
}

static void
gxml_document_type_instance_init (GXmlDocumentType * self,
                                  gpointer klass)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	_tmp0_ = g_strdup ("");
	self->_name = _tmp0_;
	_tmp1_ = g_strdup ("");
	self->_public_id = _tmp1_;
	_tmp2_ = g_strdup ("");
	self->_system_id = _tmp2_;
}

static void
gxml_document_type_finalize (GObject * obj)
{
	GXmlDocumentType * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_DOCUMENT_TYPE, GXmlDocumentType);
	_g_free0 (self->_name);
	_g_free0 (self->_public_id);
	_g_free0 (self->_system_id);
	G_OBJECT_CLASS (gxml_document_type_parent_class)->finalize (obj);
}

static GType
gxml_document_type_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlDocumentTypeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_document_type_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlDocumentType), 0, (GInstanceInitFunc) gxml_document_type_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_child_node_info = { (GInterfaceInitFunc) gxml_document_type_gxml_dom_child_node_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_document_type_info = { (GInterfaceInitFunc) gxml_document_type_gxml_dom_document_type_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_document_type_type_id;
	gxml_document_type_type_id = g_type_register_static (GXML_TYPE_NODE, "GXmlDocumentType", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_document_type_type_id, GXML_TYPE_DOM_CHILD_NODE, &gxml_dom_child_node_info);
	g_type_add_interface_static (gxml_document_type_type_id, GXML_TYPE_DOM_DOCUMENT_TYPE, &gxml_dom_document_type_info);
	return gxml_document_type_type_id;
}

GType
gxml_document_type_get_type (void)
{
	static volatile gsize gxml_document_type_type_id__once = 0;
	if (g_once_init_enter (&gxml_document_type_type_id__once)) {
		GType gxml_document_type_type_id;
		gxml_document_type_type_id = gxml_document_type_get_type_once ();
		g_once_init_leave (&gxml_document_type_type_id__once, gxml_document_type_type_id);
	}
	return gxml_document_type_type_id__once;
}

static void
_vala_gxml_document_type_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec)
{
	GXmlDocumentType * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_DOCUMENT_TYPE, GXmlDocumentType);
	switch (property_id) {
		case GXML_DOCUMENT_TYPE_NAME_PROPERTY:
		g_value_set_string (value, gxml_dom_document_type_get_name ((GXmlDomDocumentType*) self));
		break;
		case GXML_DOCUMENT_TYPE_PUBLIC_ID_PROPERTY:
		g_value_set_string (value, gxml_dom_document_type_get_public_id ((GXmlDomDocumentType*) self));
		break;
		case GXML_DOCUMENT_TYPE_SYSTEM_ID_PROPERTY:
		g_value_set_string (value, gxml_dom_document_type_get_system_id ((GXmlDomDocumentType*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

GXmlDocumentFragment*
gxml_document_fragment_construct (GType object_type,
                                  GXmlDomDocument* doc)
{
	GXmlDocumentFragment * self = NULL;
	GXmlDomDocument* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (doc != NULL, NULL);
	self = (GXmlDocumentFragment*) gxml_node_construct (object_type);
	_tmp0_ = _g_object_ref0 (doc);
	_g_object_unref0 (((GXmlNode*) self)->_document);
	((GXmlNode*) self)->_document = _tmp0_;
	((GXmlNode*) self)->_node_type = GXML_DOM_NODE_NODE_TYPE_DOCUMENT_FRAGMENT_NODE;
	_tmp1_ = g_strdup ("#document-fragment");
	_g_free0 (((GXmlNode*) self)->_local_name);
	((GXmlNode*) self)->_local_name = _tmp1_;
	return self;
}

GXmlDocumentFragment*
gxml_document_fragment_new (GXmlDomDocument* doc)
{
	return gxml_document_fragment_construct (GXML_TYPE_DOCUMENT_FRAGMENT, doc);
}

static GXmlDomHTMLCollection*
gxml_document_fragment_real_get_children (GXmlDomParentNode* base)
{
	GXmlDomHTMLCollection* result;
	GXmlDocumentFragment* self;
	GXmlHTMLCollection* l = NULL;
	GXmlHTMLCollection* _tmp0_;
	self = (GXmlDocumentFragment*) base;
	_tmp0_ = gxml_html_collection_new ();
	l = _tmp0_;
	{
		GXmlDomNodeList* _n_list = NULL;
		GXmlDomNodeList* _tmp1_;
		GXmlDomNodeList* _tmp2_;
		gint _n_size = 0;
		GXmlDomNodeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _n_index = 0;
		_tmp1_ = gxml_dom_node_get_child_nodes ((GXmlDomNode*) self);
		_tmp2_ = _tmp1_;
		_n_list = _tmp2_;
		_tmp3_ = _n_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_n_size = _tmp5_;
		_n_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			GXmlDomNode* n = NULL;
			GXmlDomNodeList* _tmp8_;
			gpointer _tmp9_;
			GXmlDomNode* _tmp10_;
			_n_index = _n_index + 1;
			_tmp6_ = _n_index;
			_tmp7_ = _n_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _n_list;
			_tmp9_ = gee_list_get ((GeeList*) _tmp8_, _n_index);
			n = (GXmlDomNode*) _tmp9_;
			_tmp10_ = n;
			if (GXML_IS_DOM_ELEMENT (_tmp10_)) {
				GXmlHTMLCollection* _tmp11_;
				GXmlDomNode* _tmp12_;
				_tmp11_ = l;
				_tmp12_ = n;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp11_, 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_document_fragment_real_get_first_element_child (GXmlDomParentNode* base)
{
	GXmlDomElement* result;
	GXmlDocumentFragment* self;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	GXmlDomHTMLCollection* _tmp2_;
	gpointer _tmp3_;
	GXmlDomElement* _tmp4_;
	self = (GXmlDocumentFragment*) 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_document_fragment_real_get_last_element_child (GXmlDomParentNode* base)
{
	GXmlDomElement* result;
	GXmlDocumentFragment* self;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	GXmlDomHTMLCollection* _tmp2_;
	gpointer _tmp3_;
	GXmlDomElement* _tmp4_;
	self = (GXmlDocumentFragment*) 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_document_fragment_real_get_child_element_count (GXmlDomParentNode* base)
{
	gint result;
	GXmlDocumentFragment* self;
	GXmlDomHTMLCollection* _tmp0_;
	GXmlDomHTMLCollection* _tmp1_;
	GXmlDomHTMLCollection* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	self = (GXmlDocumentFragment*) base;
	_tmp0_ = gxml_dom_parent_node_get_children ((GXmlDomParentNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = (gint) _tmp4_;
	_g_object_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}

static GXmlDomElement*
gxml_document_fragment_real_query_selector (GXmlDomParentNode* base,
                                            const gchar* selectors,
                                            GError** error)
{
	GXmlDocumentFragment * self;
	GError* _tmp0_;
	GError* _inner_error0_ = NULL;
	self = (GXmlDocumentFragment*) base;
	g_return_val_if_fail (selectors != NULL, NULL);
	_tmp0_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_SYNTAX_ERROR, _ ("DomElement query_selector is not implemented"));
	_inner_error0_ = _tmp0_;
	g_propagate_error (error, _inner_error0_);
	return NULL;
}

static GXmlDomNodeList*
gxml_document_fragment_real_query_selector_all (GXmlDomParentNode* base,
                                                const gchar* selectors,
                                                GError** error)
{
	GXmlDocumentFragment * self;
	GError* _tmp0_;
	GError* _inner_error0_ = NULL;
	self = (GXmlDocumentFragment*) base;
	g_return_val_if_fail (selectors != NULL, NULL);
	_tmp0_ = g_error_new_literal (GXML_DOM_ERROR, GXML_DOM_ERROR_SYNTAX_ERROR, _ ("DomElement query_selector_all is not implemented"));
	_inner_error0_ = _tmp0_;
	g_propagate_error (error, _inner_error0_);
	return NULL;
}

static GXmlDomElement*
gxml_document_fragment_real_get_element_by_id (GXmlDomNonElementParentNode* base,
                                               const gchar* element_id,
                                               GError** error)
{
	GXmlDocumentFragment * self;
	GXmlDomElementList* l = NULL;
	GXmlDomElementList* _tmp0_;
	GXmlDomElementList* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	GXmlDomElementList* _tmp4_;
	GXmlDomElement* _tmp5_;
	GXmlDomElement* _tmp6_;
	GXmlDomElement* _tmp7_;
	GXmlDomElement* result;
	self = (GXmlDocumentFragment*) base;
	g_return_val_if_fail (element_id != NULL, NULL);
	_tmp0_ = gxml_dom_parent_node_get_elements_by_property_value ((GXmlDomParentNode*) self, "id", element_id);
	l = _tmp0_;
	_tmp1_ = l;
	_tmp2_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == 0) {
		result = NULL;
		_g_object_unref0 (l);
		return result;
	}
	_tmp4_ = l;
	_tmp5_ = gxml_dom_html_collection_get_element ((GXmlDomHTMLCollection*) _tmp4_, 0);
	_tmp6_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, GXML_TYPE_DOM_ELEMENT, GXmlDomElement);
	_tmp7_ = GXML_IS_DOM_ELEMENT (_tmp6_) ? ((GXmlDomElement*) _tmp6_) : NULL;
	if (_tmp7_ == NULL) {
		_g_object_unref0 (_tmp6_);
	}
	result = _tmp7_;
	_g_object_unref0 (l);
	return result;
}

static void
gxml_document_fragment_class_init (GXmlDocumentFragmentClass * klass,
                                   gpointer klass_data)
{
	gxml_document_fragment_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_document_fragment_get_property;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_DOCUMENT_FRAGMENT_CHILDREN_PROPERTY, gxml_document_fragment_properties[GXML_DOCUMENT_FRAGMENT_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_DOCUMENT_FRAGMENT_FIRST_ELEMENT_CHILD_PROPERTY, gxml_document_fragment_properties[GXML_DOCUMENT_FRAGMENT_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_DOCUMENT_FRAGMENT_LAST_ELEMENT_CHILD_PROPERTY, gxml_document_fragment_properties[GXML_DOCUMENT_FRAGMENT_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_DOCUMENT_FRAGMENT_CHILD_ELEMENT_COUNT_PROPERTY, gxml_document_fragment_properties[GXML_DOCUMENT_FRAGMENT_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_document_fragment_gxml_dom_parent_node_interface_init (GXmlDomParentNodeIface * iface,
                                                            gpointer iface_data)
{
	gxml_document_fragment_gxml_dom_parent_node_parent_iface = g_type_interface_peek_parent (iface);
	iface->query_selector = (GXmlDomElement* (*) (GXmlDomParentNode*, const gchar*, GError**)) gxml_document_fragment_real_query_selector;
	iface->query_selector_all = (GXmlDomNodeList* (*) (GXmlDomParentNode*, const gchar*, GError**)) gxml_document_fragment_real_query_selector_all;
	iface->get_children = gxml_document_fragment_real_get_children;
	iface->get_first_element_child = gxml_document_fragment_real_get_first_element_child;
	iface->get_last_element_child = gxml_document_fragment_real_get_last_element_child;
	iface->get_child_element_count = gxml_document_fragment_real_get_child_element_count;
}

static void
gxml_document_fragment_gxml_dom_non_element_parent_node_interface_init (GXmlDomNonElementParentNodeIface * iface,
                                                                        gpointer iface_data)
{
	gxml_document_fragment_gxml_dom_non_element_parent_node_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_element_by_id = (GXmlDomElement* (*) (GXmlDomNonElementParentNode*, const gchar*, GError**)) gxml_document_fragment_real_get_element_by_id;
}

static void
gxml_document_fragment_gxml_dom_document_fragment_interface_init (GXmlDomDocumentFragmentIface * iface,
                                                                  gpointer iface_data)
{
	gxml_document_fragment_gxml_dom_document_fragment_parent_iface = g_type_interface_peek_parent (iface);
}

static void
gxml_document_fragment_instance_init (GXmlDocumentFragment * self,
                                      gpointer klass)
{
}

static GType
gxml_document_fragment_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlDocumentFragmentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_document_fragment_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlDocumentFragment), 0, (GInstanceInitFunc) gxml_document_fragment_instance_init, NULL };
	static const GInterfaceInfo gxml_dom_parent_node_info = { (GInterfaceInitFunc) gxml_document_fragment_gxml_dom_parent_node_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_non_element_parent_node_info = { (GInterfaceInitFunc) gxml_document_fragment_gxml_dom_non_element_parent_node_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo gxml_dom_document_fragment_info = { (GInterfaceInitFunc) gxml_document_fragment_gxml_dom_document_fragment_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType gxml_document_fragment_type_id;
	gxml_document_fragment_type_id = g_type_register_static (GXML_TYPE_NODE, "GXmlDocumentFragment", &g_define_type_info, 0);
	g_type_add_interface_static (gxml_document_fragment_type_id, GXML_TYPE_DOM_PARENT_NODE, &gxml_dom_parent_node_info);
	g_type_add_interface_static (gxml_document_fragment_type_id, GXML_TYPE_DOM_NON_ELEMENT_PARENT_NODE, &gxml_dom_non_element_parent_node_info);
	g_type_add_interface_static (gxml_document_fragment_type_id, GXML_TYPE_DOM_DOCUMENT_FRAGMENT, &gxml_dom_document_fragment_info);
	return gxml_document_fragment_type_id;
}

GType
gxml_document_fragment_get_type (void)
{
	static volatile gsize gxml_document_fragment_type_id__once = 0;
	if (g_once_init_enter (&gxml_document_fragment_type_id__once)) {
		GType gxml_document_fragment_type_id;
		gxml_document_fragment_type_id = gxml_document_fragment_get_type_once ();
		g_once_init_leave (&gxml_document_fragment_type_id__once, gxml_document_fragment_type_id);
	}
	return gxml_document_fragment_type_id__once;
}

static void
_vala_gxml_document_fragment_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec)
{
	GXmlDocumentFragment * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_DOCUMENT_FRAGMENT, GXmlDocumentFragment);
	switch (property_id) {
		case GXML_DOCUMENT_FRAGMENT_CHILDREN_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_children ((GXmlDomParentNode*) self));
		break;
		case GXML_DOCUMENT_FRAGMENT_FIRST_ELEMENT_CHILD_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_first_element_child ((GXmlDomParentNode*) self));
		break;
		case GXML_DOCUMENT_FRAGMENT_LAST_ELEMENT_CHILD_PROPERTY:
		g_value_take_object (value, gxml_dom_parent_node_get_last_element_child ((GXmlDomParentNode*) self));
		break;
		case GXML_DOCUMENT_FRAGMENT_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_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;
}

