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

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

#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _GxmlDomDocumentWriteFileAsyncData GxmlDomDocumentWriteFileAsyncData;
typedef struct _GxmlDomDocumentWriteStreamAsyncData GxmlDomDocumentWriteStreamAsyncData;
typedef struct _GxmlDomDocumentCreateStreamAsyncData GxmlDomDocumentCreateStreamAsyncData;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _GxmlDomDocumentWriteStringAsyncData GxmlDomDocumentWriteStringAsyncData;
typedef struct _GxmlDomDocumentReadFromFileAsyncData GxmlDomDocumentReadFromFileAsyncData;
typedef struct _GxmlDomDocumentReadFromStringAsyncData GxmlDomDocumentReadFromStringAsyncData;
typedef struct _GxmlDomDocumentReadFromStreamAsyncData GxmlDomDocumentReadFromStreamAsyncData;

struct _GxmlDomDocumentWriteFileAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomDocument* self;
	GFile* file;
	GCancellable* cancellable;
	GXmlParser* parser;
	GXmlParser* _tmp0_;
	GError* _inner_error0_;
};

struct _GxmlDomDocumentWriteStreamAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomDocument* self;
	GOutputStream* stream;
	GCancellable* cancellable;
	GXmlParser* parser;
	GXmlParser* _tmp0_;
	GError* _inner_error0_;
};

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

struct _GxmlDomDocumentWriteStringAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomDocument* self;
	GCancellable* cancellable;
	gchar* result;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	GError* _inner_error0_;
};

struct _GxmlDomDocumentReadFromFileAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomDocument* self;
	GFile* file;
	GCancellable* cancellable;
	GXmlParser* parser;
	GXmlParser* _tmp0_;
	GError* _inner_error0_;
};

struct _GxmlDomDocumentReadFromStringAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomDocument* self;
	gchar* str;
	GCancellable* cancellable;
	GXmlParser* parser;
	GXmlParser* _tmp0_;
	GError* _inner_error0_;
};

struct _GxmlDomDocumentReadFromStreamAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GXmlDomDocument* self;
	GInputStream* stream;
	GCancellable* cancellable;
	GXmlParser* parser;
	GXmlParser* _tmp0_;
	GError* _inner_error0_;
};

static void gxml_dom_document_real_write_file (GXmlDomDocument* self,
                                        GFile* file,
                                        GCancellable* cancellable,
                                        GError** error);
static void gxml_dom_document_real_write_file_async_data_free (gpointer _data);
static void gxml_dom_document_real_write_file_async (GXmlDomDocument* self,
                                              GFile* file,
                                              GCancellable* cancellable,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static gboolean gxml_dom_document_real_write_file_async_co (GxmlDomDocumentWriteFileAsyncData* _data_);
static void gxml_dom_document_write_file_async_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
static void gxml_dom_document_real_write_stream (GXmlDomDocument* self,
                                          GOutputStream* stream,
                                          GCancellable* cancellable,
                                          GError** error);
static void gxml_dom_document_real_write_stream_async_data_free (gpointer _data);
static void gxml_dom_document_real_write_stream_async (GXmlDomDocument* self,
                                                GOutputStream* stream,
                                                GCancellable* cancellable,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static gboolean gxml_dom_document_real_write_stream_async_co (GxmlDomDocumentWriteStreamAsyncData* _data_);
static void gxml_dom_document_write_stream_async_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_);
static GInputStream* gxml_dom_document_real_create_stream (GXmlDomDocument* self,
                                                    GError** error);
static void gxml_dom_document_real_create_stream_async_data_free (gpointer _data);
static void gxml_dom_document_real_create_stream_async (GXmlDomDocument* self,
                                                 GCancellable* cancellable,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_);
static gboolean gxml_dom_document_real_create_stream_async_co (GxmlDomDocumentCreateStreamAsyncData* _data_);
static void gxml_dom_document_create_stream_async_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
static gchar* gxml_dom_document_real_write_string (GXmlDomDocument* self,
                                            GCancellable* cancellable,
                                            GError** error);
static void gxml_dom_document_real_write_string_async_data_free (gpointer _data);
static void gxml_dom_document_real_write_string_async (GXmlDomDocument* self,
                                                GCancellable* cancellable,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
static gboolean gxml_dom_document_real_write_string_async_co (GxmlDomDocumentWriteStringAsyncData* _data_);
static gboolean _gxml_dom_document_real_write_string_async_co_gsource_func (gpointer self);
static void gxml_dom_document_real_read_from_file (GXmlDomDocument* self,
                                            GFile* file,
                                            GCancellable* cancellable,
                                            GError** error);
static void gxml_dom_document_real_read_from_file_async_data_free (gpointer _data);
static void gxml_dom_document_real_read_from_file_async (GXmlDomDocument* self,
                                                  GFile* file,
                                                  GCancellable* cancellable,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
static gboolean gxml_dom_document_real_read_from_file_async_co (GxmlDomDocumentReadFromFileAsyncData* _data_);
static void gxml_dom_document_read_from_file_async_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
static void gxml_dom_document_real_read_from_string (GXmlDomDocument* self,
                                              const gchar* str,
                                              GCancellable* cancellable,
                                              GError** error);
static void gxml_dom_document_real_read_from_string_async_data_free (gpointer _data);
static void gxml_dom_document_real_read_from_string_async (GXmlDomDocument* self,
                                                    const gchar* str,
                                                    GCancellable* cancellable,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
static gboolean gxml_dom_document_real_read_from_string_async_co (GxmlDomDocumentReadFromStringAsyncData* _data_);
static void gxml_dom_document_read_from_string_async_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
static void gxml_dom_document_real_read_from_stream (GXmlDomDocument* self,
                                              GInputStream* stream,
                                              GCancellable* cancellable,
                                              GError** error);
static void gxml_dom_document_real_read_from_stream_async_data_free (gpointer _data);
static void gxml_dom_document_real_read_from_stream_async (GXmlDomDocument* self,
                                                    GInputStream* stream,
                                                    GCancellable* cancellable,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
static gboolean gxml_dom_document_real_read_from_stream_async_co (GxmlDomDocumentReadFromStreamAsyncData* _data_);
static void gxml_dom_document_read_from_stream_async_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
static GType gxml_dom_document_get_type_once (void);
static GType gxml_dom_xml_document_get_type_once (void);
static gboolean gxml_dom_implementation_real_has_feature (GXmlDomImplementation* self);
static GType gxml_dom_implementation_get_type_once (void);
static GType gxml_dom_document_fragment_get_type_once (void);
static GType gxml_dom_document_type_get_type_once (void);

GXmlDomImplementation*
gxml_dom_document_get_implementation (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_implementation) {
		return _iface_->get_implementation (self);
	}
	return NULL;
}

const gchar*
gxml_dom_document_get_url (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_url) {
		return _iface_->get_url (self);
	}
	return NULL;
}

const gchar*
gxml_dom_document_get_document_uri (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_document_uri) {
		return _iface_->get_document_uri (self);
	}
	return NULL;
}

const gchar*
gxml_dom_document_get_origin (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_origin) {
		return _iface_->get_origin (self);
	}
	return NULL;
}

const gchar*
gxml_dom_document_get_compat_mode (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_compat_mode) {
		return _iface_->get_compat_mode (self);
	}
	return NULL;
}

const gchar*
gxml_dom_document_get_character_set (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_character_set) {
		return _iface_->get_character_set (self);
	}
	return NULL;
}

const gchar*
gxml_dom_document_get_content_type (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_content_type) {
		return _iface_->get_content_type (self);
	}
	return NULL;
}

GXmlDomDocumentType*
gxml_dom_document_get_doctype (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_doctype) {
		return _iface_->get_doctype (self);
	}
	return NULL;
}

GXmlDomElement*
gxml_dom_document_get_document_element (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_document_element) {
		return _iface_->get_document_element (self);
	}
	return NULL;
}

GXmlDomHTMLCollection*
gxml_dom_document_get_elements_by_tag_name (GXmlDomDocument* self,
                                            const gchar* local_name)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_elements_by_tag_name) {
		return _iface_->get_elements_by_tag_name (self, local_name);
	}
	return NULL;
}

GXmlDomHTMLCollection*
gxml_dom_document_get_elements_by_tag_name_ns (GXmlDomDocument* self,
                                               const gchar* namespace,
                                               const gchar* local_name)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_elements_by_tag_name_ns) {
		return _iface_->get_elements_by_tag_name_ns (self, namespace, local_name);
	}
	return NULL;
}

GXmlDomHTMLCollection*
gxml_dom_document_get_elements_by_class_name (GXmlDomDocument* self,
                                              const gchar* classNames)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_elements_by_class_name) {
		return _iface_->get_elements_by_class_name (self, classNames);
	}
	return NULL;
}

GXmlDomElement*
gxml_dom_document_create_element (GXmlDomDocument* self,
                                  const gchar* local_name,
                                  GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_element) {
		return _iface_->create_element (self, local_name, error);
	}
	return NULL;
}

GXmlDomElement*
gxml_dom_document_create_element_ns (GXmlDomDocument* self,
                                     const gchar* namespace,
                                     const gchar* qualified_name,
                                     GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_element_ns) {
		return _iface_->create_element_ns (self, namespace, qualified_name, error);
	}
	return NULL;
}

GXmlDomDocumentFragment*
gxml_dom_document_create_document_fragment (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_document_fragment) {
		return _iface_->create_document_fragment (self);
	}
	return NULL;
}

GXmlDomText*
gxml_dom_document_create_text_node (GXmlDomDocument* self,
                                    const gchar* data,
                                    GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_text_node) {
		return _iface_->create_text_node (self, data, error);
	}
	return NULL;
}

GXmlDomComment*
gxml_dom_document_create_comment (GXmlDomDocument* self,
                                  const gchar* data,
                                  GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_comment) {
		return _iface_->create_comment (self, data, error);
	}
	return NULL;
}

GXmlDomProcessingInstruction*
gxml_dom_document_create_processing_instruction (GXmlDomDocument* self,
                                                 const gchar* target,
                                                 const gchar* data,
                                                 GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_processing_instruction) {
		return _iface_->create_processing_instruction (self, target, data, error);
	}
	return NULL;
}

GXmlDomNode*
gxml_dom_document_import_node (GXmlDomDocument* self,
                               GXmlDomNode* node,
                               gboolean deep,
                               GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->import_node) {
		return _iface_->import_node (self, node, deep, error);
	}
	return NULL;
}

GXmlDomNode*
gxml_dom_document_adopt_node (GXmlDomDocument* self,
                              GXmlDomNode* node,
                              GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->adopt_node) {
		return _iface_->adopt_node (self, node, error);
	}
	return NULL;
}

/**
   * No implemented jet. This can lead to API changes in future versions.
   */
GXmlDomEvent*
gxml_dom_document_create_event (GXmlDomDocument* self,
                                const gchar* interface,
                                GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_event) {
		return _iface_->create_event (self, interface, error);
	}
	return NULL;
}

/**
   * No implemented jet. This can lead to API changes in future versions.
   */
GXmlDomRange*
gxml_dom_document_create_range (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_range) {
		return _iface_->create_range (self);
	}
	return NULL;
}

/**
   * Creates a {@link DomNodeIterator}.
   *
   * Consider to connect to {@link DomNodeIterator.accept_node} in order to
   * filter the nodes you iterate on.
   *
   * See at {@link DomNodeFilter} for the constant value of @what_to_show
   */
GXmlDomNodeIterator*
gxml_dom_document_create_node_iterator (GXmlDomDocument* self,
                                        GXmlDomNode* root,
                                        gint whatToShow)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_node_iterator) {
		return _iface_->create_node_iterator (self, root, whatToShow);
	}
	return NULL;
}

/**
   * Creates a {@link DomTreeWalker}.
   *
   * Consider to connect to {@link DomTreeWalker.accept_node} in order to
   * filter the nodes you iterate on.
   *
   * See at {@link DomNodeFilter} for the constant value of @what_to_show
   */
GXmlDomTreeWalker*
gxml_dom_document_create_tree_walker (GXmlDomDocument* self,
                                      GXmlDomNode* root,
                                      gint what_to_show)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_tree_walker) {
		return _iface_->create_tree_walker (self, root, what_to_show);
	}
	return NULL;
}

/**
   * Writes a dump XML representation of document to a file.
   */
static void
gxml_dom_document_real_write_file (GXmlDomDocument* self,
                                   GFile* file,
                                   GCancellable* cancellable,
                                   GError** error)
{
	GXmlParser* parser = NULL;
	GXmlParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (file != NULL);
	_tmp0_ = gxml_dom_document_get_xml_parser (self);
	parser = _tmp0_;
	gxml_parser_write_file (parser, file, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return;
	}
	_g_object_unref0 (parser);
}

void
gxml_dom_document_write_file (GXmlDomDocument* self,
                              GFile* file,
                              GCancellable* cancellable,
                              GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->write_file) {
		_iface_->write_file (self, file, cancellable, error);
	}
}

static void
gxml_dom_document_real_write_file_async_data_free (gpointer _data)
{
	GxmlDomDocumentWriteFileAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlDomDocumentWriteFileAsyncData, _data_);
}

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

static void
gxml_dom_document_real_write_file_async (GXmlDomDocument* self,
                                         GFile* file,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	GxmlDomDocumentWriteFileAsyncData* _data_;
	GXmlDomDocument* _tmp0_;
	GFile* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (file != NULL);
	_data_ = g_slice_new0 (GxmlDomDocumentWriteFileAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_document_real_write_file_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (file);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_document_real_write_file_async_co (_data_);
}

static void
gxml_dom_document_real_write_file_finish (GXmlDomDocument* self,
                                          GAsyncResult* _res_,
                                          GError** error)
{
	GxmlDomDocumentWriteFileAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Writes asynchronically a dump XML representation of document to a file.
   */
static void
gxml_dom_document_write_file_async_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	GxmlDomDocumentWriteFileAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_dom_document_real_write_file_async_co (_data_);
}

static gboolean
gxml_dom_document_real_write_file_async_co (GxmlDomDocumentWriteFileAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_dom_document_get_xml_parser (_data_->self);
	_data_->parser = _data_->_tmp0_;
	_data_->_state_ = 1;
	gxml_parser_write_file_async (_data_->parser, _data_->file, gxml_dom_document_write_file_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_parser_write_file_finish (_data_->parser, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->parser);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->parser);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
gxml_dom_document_write_file_async (GXmlDomDocument* self,
                                    GFile* file,
                                    GCancellable* cancellable,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->write_file_async) {
		_iface_->write_file_async (self, file, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_document_write_file_finish (GXmlDomDocument* self,
                                     GAsyncResult* _res_,
                                     GError** error)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->write_file_finish) {
		_iface_->write_file_finish (self, _res_, error);
	}
}

/**
   * Writes a dump XML representation of document to a stream.
   */
static void
gxml_dom_document_real_write_stream (GXmlDomDocument* self,
                                     GOutputStream* stream,
                                     GCancellable* cancellable,
                                     GError** error)
{
	GXmlParser* parser = NULL;
	GXmlParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (stream != NULL);
	_tmp0_ = gxml_dom_document_get_xml_parser (self);
	parser = _tmp0_;
	gxml_parser_write_stream (parser, stream, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return;
	}
	_g_object_unref0 (parser);
}

void
gxml_dom_document_write_stream (GXmlDomDocument* self,
                                GOutputStream* stream,
                                GCancellable* cancellable,
                                GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->write_stream) {
		_iface_->write_stream (self, stream, cancellable, error);
	}
}

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

static void
gxml_dom_document_real_write_stream_async (GXmlDomDocument* self,
                                           GOutputStream* stream,
                                           GCancellable* cancellable,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	GxmlDomDocumentWriteStreamAsyncData* _data_;
	GXmlDomDocument* _tmp0_;
	GOutputStream* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (stream != NULL);
	_data_ = g_slice_new0 (GxmlDomDocumentWriteStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_document_real_write_stream_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_document_real_write_stream_async_co (_data_);
}

static void
gxml_dom_document_real_write_stream_finish (GXmlDomDocument* self,
                                            GAsyncResult* _res_,
                                            GError** error)
{
	GxmlDomDocumentWriteStreamAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Writes a dump XML representation of document to a stream.
   */
static void
gxml_dom_document_write_stream_async_ready (GObject* source_object,
                                            GAsyncResult* _res_,
                                            gpointer _user_data_)
{
	GxmlDomDocumentWriteStreamAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_dom_document_real_write_stream_async_co (_data_);
}

static gboolean
gxml_dom_document_real_write_stream_async_co (GxmlDomDocumentWriteStreamAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_dom_document_get_xml_parser (_data_->self);
	_data_->parser = _data_->_tmp0_;
	_data_->_state_ = 1;
	gxml_parser_write_stream_async (_data_->parser, _data_->stream, gxml_dom_document_write_stream_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_parser_write_stream_finish (_data_->parser, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->parser);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->parser);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
gxml_dom_document_write_stream_async (GXmlDomDocument* self,
                                      GOutputStream* stream,
                                      GCancellable* cancellable,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->write_stream_async) {
		_iface_->write_stream_async (self, stream, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_document_write_stream_finish (GXmlDomDocument* self,
                                       GAsyncResult* _res_,
                                       GError** error)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->write_stream_finish) {
		_iface_->write_stream_finish (self, _res_, error);
	}
}

/**
   * Creates an {@link GLib.InputStream} to write a string representation
   * in XML of {@link GXml.Document}
   */
static GInputStream*
gxml_dom_document_real_create_stream (GXmlDomDocument* self,
                                      GError** error)
{
	GXmlParser* parser = NULL;
	GXmlParser* _tmp0_;
	GInputStream* _tmp1_ = NULL;
	GInputStream* _tmp2_;
	GInputStream* _tmp3_;
	GError* _inner_error0_ = NULL;
	GInputStream* result;
	_tmp0_ = gxml_dom_document_get_xml_parser (self);
	parser = _tmp0_;
	_tmp2_ = gxml_parser_create_stream (parser, &_inner_error0_);
	_tmp1_ = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return NULL;
	}
	_tmp3_ = _tmp1_;
	_tmp1_ = NULL;
	result = _tmp3_;
	_g_object_unref0 (_tmp1_);
	_g_object_unref0 (parser);
	return result;
}

GInputStream*
gxml_dom_document_create_stream (GXmlDomDocument* self,
                                 GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_stream) {
		return _iface_->create_stream (self, error);
	}
	return NULL;
}

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

static void
gxml_dom_document_real_create_stream_async (GXmlDomDocument* self,
                                            GCancellable* cancellable,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_)
{
	GxmlDomDocumentCreateStreamAsyncData* _data_;
	GXmlDomDocument* _tmp0_;
	GCancellable* _tmp1_;
	_data_ = g_slice_new0 (GxmlDomDocumentCreateStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_document_real_create_stream_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	gxml_dom_document_real_create_stream_async_co (_data_);
}

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

/**
   * Creates an {@link GLib.InputStream} to write a string representation
   * in XML of {@link GXml.Document}
   */
static void
gxml_dom_document_create_stream_async_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	GxmlDomDocumentCreateStreamAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_dom_document_real_create_stream_async_co (_data_);
}

static gboolean
gxml_dom_document_real_create_stream_async_co (GxmlDomDocumentCreateStreamAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_dom_document_get_xml_parser (_data_->self);
	_data_->parser = _data_->_tmp0_;
	gxml_parser_set_cancellable (_data_->parser, _data_->cancellable);
	_data_->_state_ = 1;
	gxml_parser_create_stream_async (_data_->parser, gxml_dom_document_create_stream_async_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = gxml_parser_create_stream_finish (_data_->parser, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp1_ = _data_->_tmp2_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->parser);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = _data_->_tmp1_;
	_data_->_tmp1_ = NULL;
	_data_->result = _data_->_tmp3_;
	_g_object_unref0 (_data_->_tmp1_);
	_g_object_unref0 (_data_->parser);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
gxml_dom_document_create_stream_async (GXmlDomDocument* self,
                                       GCancellable* cancellable,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_stream_async) {
		_iface_->create_stream_async (self, cancellable, _callback_, _user_data_);
	}
}

GInputStream*
gxml_dom_document_create_stream_finish (GXmlDomDocument* self,
                                        GAsyncResult* _res_,
                                        GError** error)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->create_stream_finish) {
		return _iface_->create_stream_finish (self, _res_, error);
	}
	return NULL;
}

/**
   * Serialize {@link GXml.Document} to a string.
   */
static gchar*
gxml_dom_document_real_write_string (GXmlDomDocument* self,
                                     GCancellable* cancellable,
                                     GError** error)
{
	GXmlParser* parser = NULL;
	GXmlParser* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	_tmp0_ = gxml_dom_document_get_xml_parser (self);
	parser = _tmp0_;
	gxml_parser_set_cancellable (parser, cancellable);
	_tmp2_ = gxml_parser_write_string (parser, &_inner_error0_);
	_tmp1_ = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return NULL;
	}
	_tmp3_ = _tmp1_;
	_tmp1_ = NULL;
	result = _tmp3_;
	_g_free0 (_tmp1_);
	_g_object_unref0 (parser);
	return result;
}

gchar*
gxml_dom_document_write_string (GXmlDomDocument* self,
                                GCancellable* cancellable,
                                GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->write_string) {
		return _iface_->write_string (self, cancellable, error);
	}
	return NULL;
}

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

static void
gxml_dom_document_real_write_string_async (GXmlDomDocument* self,
                                           GCancellable* cancellable,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	GxmlDomDocumentWriteStringAsyncData* _data_;
	GXmlDomDocument* _tmp0_;
	GCancellable* _tmp1_;
	_data_ = g_slice_new0 (GxmlDomDocumentWriteStringAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_document_real_write_string_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	gxml_dom_document_real_write_string_async_co (_data_);
}

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

/**
   * Serialize {@link GXml.Document} to a string.
   */
static gboolean
_gxml_dom_document_real_write_string_async_co_gsource_func (gpointer self)
{
	gboolean result;
	result = gxml_dom_document_real_write_string_async_co (self);
	return result;
}

static gboolean
gxml_dom_document_real_write_string_async_co (GxmlDomDocumentWriteStringAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _gxml_dom_document_real_write_string_async_co_gsource_func, _data_, NULL);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp1_ = gxml_dom_document_write_string (_data_->self, _data_->cancellable, &_data_->_inner_error0_);
	_data_->_tmp0_ = _data_->_tmp1_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = _data_->_tmp0_;
	_data_->_tmp0_ = NULL;
	_data_->result = _data_->_tmp2_;
	_g_free0 (_data_->_tmp0_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
gxml_dom_document_write_string_async (GXmlDomDocument* self,
                                      GCancellable* cancellable,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->write_string_async) {
		_iface_->write_string_async (self, cancellable, _callback_, _user_data_);
	}
}

gchar*
gxml_dom_document_write_string_finish (GXmlDomDocument* self,
                                       GAsyncResult* _res_,
                                       GError** error)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->write_string_finish) {
		return _iface_->write_string_finish (self, _res_, error);
	}
	return NULL;
}

/**
   * Reads a file contents and parse it to document.
   */
static void
gxml_dom_document_real_read_from_file (GXmlDomDocument* self,
                                       GFile* file,
                                       GCancellable* cancellable,
                                       GError** error)
{
	GXmlParser* parser = NULL;
	GXmlParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (file != NULL);
	_tmp0_ = gxml_dom_document_get_xml_parser (self);
	parser = _tmp0_;
	gxml_parser_set_cancellable (parser, cancellable);
	gxml_parser_read_file (parser, file, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return;
	}
	_g_object_unref0 (parser);
}

void
gxml_dom_document_read_from_file (GXmlDomDocument* self,
                                  GFile* file,
                                  GCancellable* cancellable,
                                  GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->read_from_file) {
		_iface_->read_from_file (self, file, cancellable, error);
	}
}

static void
gxml_dom_document_real_read_from_file_async_data_free (gpointer _data)
{
	GxmlDomDocumentReadFromFileAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->file);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (GxmlDomDocumentReadFromFileAsyncData, _data_);
}

static void
gxml_dom_document_real_read_from_file_async (GXmlDomDocument* self,
                                             GFile* file,
                                             GCancellable* cancellable,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	GxmlDomDocumentReadFromFileAsyncData* _data_;
	GXmlDomDocument* _tmp0_;
	GFile* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (file != NULL);
	_data_ = g_slice_new0 (GxmlDomDocumentReadFromFileAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_document_real_read_from_file_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (file);
	_g_object_unref0 (_data_->file);
	_data_->file = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_document_real_read_from_file_async_co (_data_);
}

static void
gxml_dom_document_real_read_from_file_finish (GXmlDomDocument* self,
                                              GAsyncResult* _res_,
                                              GError** error)
{
	GxmlDomDocumentReadFromFileAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Reads a file contents and parse it to document.
   */
static void
gxml_dom_document_read_from_file_async_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	GxmlDomDocumentReadFromFileAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_dom_document_real_read_from_file_async_co (_data_);
}

static gboolean
gxml_dom_document_real_read_from_file_async_co (GxmlDomDocumentReadFromFileAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_dom_document_get_xml_parser (_data_->self);
	_data_->parser = _data_->_tmp0_;
	gxml_parser_set_cancellable (_data_->parser, _data_->cancellable);
	_data_->_state_ = 1;
	gxml_parser_read_file_async (_data_->parser, _data_->file, gxml_dom_document_read_from_file_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_parser_read_file_finish (_data_->parser, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->parser);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->parser);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
gxml_dom_document_read_from_file_async (GXmlDomDocument* self,
                                        GFile* file,
                                        GCancellable* cancellable,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->read_from_file_async) {
		_iface_->read_from_file_async (self, file, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_document_read_from_file_finish (GXmlDomDocument* self,
                                         GAsyncResult* _res_,
                                         GError** error)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->read_from_file_finish) {
		_iface_->read_from_file_finish (self, _res_, error);
	}
}

/**
   * Reads a string and parse it to document.
   */
static void
gxml_dom_document_real_read_from_string (GXmlDomDocument* self,
                                         const gchar* str,
                                         GCancellable* cancellable,
                                         GError** error)
{
	GXmlParser* parser = NULL;
	GXmlParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (str != NULL);
	_tmp0_ = gxml_dom_document_get_xml_parser (self);
	parser = _tmp0_;
	gxml_parser_set_cancellable (parser, cancellable);
	gxml_parser_read_string (parser, str, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return;
	}
	_g_object_unref0 (parser);
}

void
gxml_dom_document_read_from_string (GXmlDomDocument* self,
                                    const gchar* str,
                                    GCancellable* cancellable,
                                    GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->read_from_string) {
		_iface_->read_from_string (self, str, cancellable, error);
	}
}

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

static void
gxml_dom_document_real_read_from_string_async (GXmlDomDocument* self,
                                               const gchar* str,
                                               GCancellable* cancellable,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	GxmlDomDocumentReadFromStringAsyncData* _data_;
	GXmlDomDocument* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (str != NULL);
	_data_ = g_slice_new0 (GxmlDomDocumentReadFromStringAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_document_real_read_from_string_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (str);
	_g_free0 (_data_->str);
	_data_->str = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_document_real_read_from_string_async_co (_data_);
}

static void
gxml_dom_document_real_read_from_string_finish (GXmlDomDocument* self,
                                                GAsyncResult* _res_,
                                                GError** error)
{
	GxmlDomDocumentReadFromStringAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Reads a string and parse it to document.
   */
static void
gxml_dom_document_read_from_string_async_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	GxmlDomDocumentReadFromStringAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_dom_document_real_read_from_string_async_co (_data_);
}

static gboolean
gxml_dom_document_real_read_from_string_async_co (GxmlDomDocumentReadFromStringAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_dom_document_get_xml_parser (_data_->self);
	_data_->parser = _data_->_tmp0_;
	gxml_parser_set_cancellable (_data_->parser, _data_->cancellable);
	_data_->_state_ = 1;
	gxml_parser_read_string_async (_data_->parser, _data_->str, gxml_dom_document_read_from_string_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_parser_read_string_finish (_data_->parser, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->parser);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->parser);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
gxml_dom_document_read_from_string_async (GXmlDomDocument* self,
                                          const gchar* str,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->read_from_string_async) {
		_iface_->read_from_string_async (self, str, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_document_read_from_string_finish (GXmlDomDocument* self,
                                           GAsyncResult* _res_,
                                           GError** error)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->read_from_string_finish) {
		_iface_->read_from_string_finish (self, _res_, error);
	}
}

/**
   * Reads a string and parse it to document.
   */
static void
gxml_dom_document_real_read_from_stream (GXmlDomDocument* self,
                                         GInputStream* stream,
                                         GCancellable* cancellable,
                                         GError** error)
{
	GXmlParser* parser = NULL;
	GXmlParser* _tmp0_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (stream != NULL);
	_tmp0_ = gxml_dom_document_get_xml_parser (self);
	parser = _tmp0_;
	gxml_parser_set_cancellable (parser, cancellable);
	gxml_parser_read_stream (parser, stream, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (parser);
		return;
	}
	_g_object_unref0 (parser);
}

void
gxml_dom_document_read_from_stream (GXmlDomDocument* self,
                                    GInputStream* stream,
                                    GCancellable* cancellable,
                                    GError** error)
{
	GXmlDomDocumentIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->read_from_stream) {
		_iface_->read_from_stream (self, stream, cancellable, error);
	}
}

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

static void
gxml_dom_document_real_read_from_stream_async (GXmlDomDocument* self,
                                               GInputStream* stream,
                                               GCancellable* cancellable,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	GxmlDomDocumentReadFromStreamAsyncData* _data_;
	GXmlDomDocument* _tmp0_;
	GInputStream* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (stream != NULL);
	_data_ = g_slice_new0 (GxmlDomDocumentReadFromStreamAsyncData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, gxml_dom_document_real_read_from_stream_async_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	gxml_dom_document_real_read_from_stream_async_co (_data_);
}

static void
gxml_dom_document_real_read_from_stream_finish (GXmlDomDocument* self,
                                                GAsyncResult* _res_,
                                                GError** error)
{
	GxmlDomDocumentReadFromStreamAsyncData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

/**
   * Reads a string and parse it to document.
   */
static void
gxml_dom_document_read_from_stream_async_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	GxmlDomDocumentReadFromStreamAsyncData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gxml_dom_document_real_read_from_stream_async_co (_data_);
}

static gboolean
gxml_dom_document_real_read_from_stream_async_co (GxmlDomDocumentReadFromStreamAsyncData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = gxml_dom_document_get_xml_parser (_data_->self);
	_data_->parser = _data_->_tmp0_;
	gxml_parser_set_cancellable (_data_->parser, _data_->cancellable);
	_data_->_state_ = 1;
	gxml_parser_read_stream_async (_data_->parser, _data_->stream, gxml_dom_document_read_from_stream_async_ready, _data_);
	return FALSE;
	_state_1:
	gxml_parser_read_stream_finish (_data_->parser, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->parser);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_g_object_unref0 (_data_->parser);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
gxml_dom_document_read_from_stream_async (GXmlDomDocument* self,
                                          GInputStream* stream,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->read_from_stream_async) {
		_iface_->read_from_stream_async (self, stream, cancellable, _callback_, _user_data_);
	}
}

void
gxml_dom_document_read_from_stream_finish (GXmlDomDocument* self,
                                           GAsyncResult* _res_,
                                           GError** error)
{
	GXmlDomDocumentIface* _iface_;
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->read_from_stream_finish) {
		_iface_->read_from_stream_finish (self, _res_, error);
	}
}

/**
   * Returns a default XML {@link Parser} to use with this object.
   */
GXmlParser*
gxml_dom_document_get_xml_parser (GXmlDomDocument* self)
{
	GXmlDomDocumentIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->get_xml_parser) {
		return _iface_->get_xml_parser (self);
	}
	return NULL;
}

/**
   * Set a default XML {@link Parser} to use with this object.
   */
void
gxml_dom_document_set_xml_parser (GXmlDomDocument* self,
                                  GXmlParser* parser)
{
	GXmlDomDocumentIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = GXML_DOM_DOCUMENT_GET_INTERFACE (self);
	if (_iface_->set_xml_parser) {
		_iface_->set_xml_parser (self, parser);
	}
}

static void
gxml_dom_document_default_init (GXmlDomDocumentIface * iface,
                                gpointer iface_data)
{
	g_object_interface_install_property (iface, g_param_spec_object ("implementation", "implementation", "implementation", GXML_TYPE_DOM_IMPLEMENTATION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("url", "url", "url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("document-uri", "document-uri", "document-uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("origin", "origin", "origin", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("compat-mode", "compat-mode", "compat-mode", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("character-set", "character-set", "character-set", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("content-type", "content-type", "content-type", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_object ("doctype", "doctype", "doctype", GXML_TYPE_DOM_DOCUMENT_TYPE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_object ("document-element", "document-element", "document-element", GXML_TYPE_DOM_ELEMENT, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	iface->write_file = gxml_dom_document_real_write_file;
	iface->write_file_async = gxml_dom_document_real_write_file_async;
	iface->write_file_finish = gxml_dom_document_real_write_file_finish;
	iface->write_stream = gxml_dom_document_real_write_stream;
	iface->write_stream_async = gxml_dom_document_real_write_stream_async;
	iface->write_stream_finish = gxml_dom_document_real_write_stream_finish;
	iface->create_stream = gxml_dom_document_real_create_stream;
	iface->create_stream_async = gxml_dom_document_real_create_stream_async;
	iface->create_stream_finish = gxml_dom_document_real_create_stream_finish;
	iface->write_string = gxml_dom_document_real_write_string;
	iface->write_string_async = gxml_dom_document_real_write_string_async;
	iface->write_string_finish = gxml_dom_document_real_write_string_finish;
	iface->read_from_file = gxml_dom_document_real_read_from_file;
	iface->read_from_file_async = gxml_dom_document_real_read_from_file_async;
	iface->read_from_file_finish = gxml_dom_document_real_read_from_file_finish;
	iface->read_from_string = gxml_dom_document_real_read_from_string;
	iface->read_from_string_async = gxml_dom_document_real_read_from_string_async;
	iface->read_from_string_finish = gxml_dom_document_real_read_from_string_finish;
	iface->read_from_stream = gxml_dom_document_real_read_from_stream;
	iface->read_from_stream_async = gxml_dom_document_real_read_from_stream_async;
	iface->read_from_stream_finish = gxml_dom_document_real_read_from_stream_finish;
}

static GType
gxml_dom_document_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlDomDocumentIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_dom_document_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gxml_dom_document_type_id;
	gxml_dom_document_type_id = g_type_register_static (G_TYPE_INTERFACE, "GXmlDomDocument", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gxml_dom_document_type_id, G_TYPE_OBJECT);
	g_type_interface_add_prerequisite (gxml_dom_document_type_id, GXML_TYPE_DOM_NODE);
	g_type_interface_add_prerequisite (gxml_dom_document_type_id, GXML_TYPE_DOM_PARENT_NODE);
	g_type_interface_add_prerequisite (gxml_dom_document_type_id, GXML_TYPE_DOM_NON_ELEMENT_PARENT_NODE);
	return gxml_dom_document_type_id;
}

GType
gxml_dom_document_get_type (void)
{
	static volatile gsize gxml_dom_document_type_id__once = 0;
	if (g_once_init_enter (&gxml_dom_document_type_id__once)) {
		GType gxml_dom_document_type_id;
		gxml_dom_document_type_id = gxml_dom_document_get_type_once ();
		g_once_init_leave (&gxml_dom_document_type_id__once, gxml_dom_document_type_id);
	}
	return gxml_dom_document_type_id__once;
}

GQuark
gxml_dom_document_error_quark (void)
{
	return g_quark_from_static_string ("gxml-dom-document-error-quark");
}

static GType
gxml_dom_document_error_get_type_once (void)
{
	static const GEnumValue values[] = {{GXML_DOM_DOCUMENT_ERROR_FILE_NOT_FOUND_ERROR, "GXML_DOM_DOCUMENT_ERROR_FILE_NOT_FOUND_ERROR", "file-not-found-error"}, {GXML_DOM_DOCUMENT_ERROR_INVALID_DOCUMENT_ERROR, "GXML_DOM_DOCUMENT_ERROR_INVALID_DOCUMENT_ERROR", "invalid-document-error"}, {0, NULL, NULL}};
	GType gxml_dom_document_error_type_id;
	gxml_dom_document_error_type_id = g_enum_register_static ("GXmlDomDocumentError", values);
	return gxml_dom_document_error_type_id;
}

GType
gxml_dom_document_error_get_type (void)
{
	static volatile gsize gxml_dom_document_error_type_id__once = 0;
	if (g_once_init_enter (&gxml_dom_document_error_type_id__once)) {
		GType gxml_dom_document_error_type_id;
		gxml_dom_document_error_type_id = gxml_dom_document_error_get_type_once ();
		g_once_init_leave (&gxml_dom_document_error_type_id__once, gxml_dom_document_error_type_id);
	}
	return gxml_dom_document_error_type_id__once;
}

static void
gxml_dom_xml_document_default_init (GXmlDomXMLDocumentIface * iface,
                                    gpointer iface_data)
{
}

static GType
gxml_dom_xml_document_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlDomXMLDocumentIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_dom_xml_document_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gxml_dom_xml_document_type_id;
	gxml_dom_xml_document_type_id = g_type_register_static (G_TYPE_INTERFACE, "GXmlDomXMLDocument", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gxml_dom_xml_document_type_id, G_TYPE_OBJECT);
	g_type_interface_add_prerequisite (gxml_dom_xml_document_type_id, GXML_TYPE_DOM_DOCUMENT);
	return gxml_dom_xml_document_type_id;
}

GType
gxml_dom_xml_document_get_type (void)
{
	static volatile gsize gxml_dom_xml_document_type_id__once = 0;
	if (g_once_init_enter (&gxml_dom_xml_document_type_id__once)) {
		GType gxml_dom_xml_document_type_id;
		gxml_dom_xml_document_type_id = gxml_dom_xml_document_get_type_once ();
		g_once_init_leave (&gxml_dom_xml_document_type_id__once, gxml_dom_xml_document_type_id);
	}
	return gxml_dom_xml_document_type_id__once;
}

GXmlDomDocumentType*
gxml_dom_implementation_create_document_type (GXmlDomImplementation* self,
                                              const gchar* qualified_name,
                                              const gchar* public_id,
                                              const gchar* system_id,
                                              GError** error)
{
	GXmlDomImplementationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_IMPLEMENTATION_GET_INTERFACE (self);
	if (_iface_->create_document_type) {
		return _iface_->create_document_type (self, qualified_name, public_id, system_id, error);
	}
	return NULL;
}

GXmlDomXMLDocument*
gxml_dom_implementation_create_document (GXmlDomImplementation* self,
                                         const gchar* nspace,
                                         const gchar* qualified_name,
                                         GXmlDomDocumentType* doctype,
                                         GError** error)
{
	GXmlDomImplementationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_IMPLEMENTATION_GET_INTERFACE (self);
	if (_iface_->create_document) {
		return _iface_->create_document (self, nspace, qualified_name, doctype, error);
	}
	return NULL;
}

GXmlDomDocument*
gxml_dom_implementation_create_html_document (GXmlDomImplementation* self,
                                              const gchar* title)
{
	GXmlDomImplementationIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_IMPLEMENTATION_GET_INTERFACE (self);
	if (_iface_->create_html_document) {
		return _iface_->create_html_document (self, title);
	}
	return NULL;
}

static gboolean
gxml_dom_implementation_real_has_feature (GXmlDomImplementation* self)
{
	gboolean result;
	result = TRUE;
	return result;
}

gboolean
gxml_dom_implementation_has_feature (GXmlDomImplementation* self)
{
	GXmlDomImplementationIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = GXML_DOM_IMPLEMENTATION_GET_INTERFACE (self);
	if (_iface_->has_feature) {
		return _iface_->has_feature (self);
	}
	return FALSE;
}

static void
gxml_dom_implementation_default_init (GXmlDomImplementationIface * iface,
                                      gpointer iface_data)
{
	iface->has_feature = gxml_dom_implementation_real_has_feature;
}

/**
 * Not implemented yet. This can lead to API changes in future versions.
 */
static GType
gxml_dom_implementation_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlDomImplementationIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_dom_implementation_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gxml_dom_implementation_type_id;
	gxml_dom_implementation_type_id = g_type_register_static (G_TYPE_INTERFACE, "GXmlDomImplementation", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gxml_dom_implementation_type_id, G_TYPE_OBJECT);
	return gxml_dom_implementation_type_id;
}

GType
gxml_dom_implementation_get_type (void)
{
	static volatile gsize gxml_dom_implementation_type_id__once = 0;
	if (g_once_init_enter (&gxml_dom_implementation_type_id__once)) {
		GType gxml_dom_implementation_type_id;
		gxml_dom_implementation_type_id = gxml_dom_implementation_get_type_once ();
		g_once_init_leave (&gxml_dom_implementation_type_id__once, gxml_dom_implementation_type_id);
	}
	return gxml_dom_implementation_type_id__once;
}

static void
gxml_dom_document_fragment_default_init (GXmlDomDocumentFragmentIface * iface,
                                         gpointer iface_data)
{
}

/**
 * Not implemented yet. This can lead to API changes in future versions.
 */
static GType
gxml_dom_document_fragment_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlDomDocumentFragmentIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_dom_document_fragment_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gxml_dom_document_fragment_type_id;
	gxml_dom_document_fragment_type_id = g_type_register_static (G_TYPE_INTERFACE, "GXmlDomDocumentFragment", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gxml_dom_document_fragment_type_id, G_TYPE_OBJECT);
	g_type_interface_add_prerequisite (gxml_dom_document_fragment_type_id, GXML_TYPE_DOM_NODE);
	g_type_interface_add_prerequisite (gxml_dom_document_fragment_type_id, GXML_TYPE_DOM_PARENT_NODE);
	g_type_interface_add_prerequisite (gxml_dom_document_fragment_type_id, GXML_TYPE_DOM_NON_ELEMENT_PARENT_NODE);
	return gxml_dom_document_fragment_type_id;
}

GType
gxml_dom_document_fragment_get_type (void)
{
	static volatile gsize gxml_dom_document_fragment_type_id__once = 0;
	if (g_once_init_enter (&gxml_dom_document_fragment_type_id__once)) {
		GType gxml_dom_document_fragment_type_id;
		gxml_dom_document_fragment_type_id = gxml_dom_document_fragment_get_type_once ();
		g_once_init_leave (&gxml_dom_document_fragment_type_id__once, gxml_dom_document_fragment_type_id);
	}
	return gxml_dom_document_fragment_type_id__once;
}

const gchar*
gxml_dom_document_type_get_name (GXmlDomDocumentType* self)
{
	GXmlDomDocumentTypeIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_TYPE_GET_INTERFACE (self);
	if (_iface_->get_name) {
		return _iface_->get_name (self);
	}
	return NULL;
}

const gchar*
gxml_dom_document_type_get_public_id (GXmlDomDocumentType* self)
{
	GXmlDomDocumentTypeIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_TYPE_GET_INTERFACE (self);
	if (_iface_->get_public_id) {
		return _iface_->get_public_id (self);
	}
	return NULL;
}

const gchar*
gxml_dom_document_type_get_system_id (GXmlDomDocumentType* self)
{
	GXmlDomDocumentTypeIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = GXML_DOM_DOCUMENT_TYPE_GET_INTERFACE (self);
	if (_iface_->get_system_id) {
		return _iface_->get_system_id (self);
	}
	return NULL;
}

static void
gxml_dom_document_type_default_init (GXmlDomDocumentTypeIface * iface,
                                     gpointer iface_data)
{
	g_object_interface_install_property (iface, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("public-id", "public-id", "public-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_interface_install_property (iface, g_param_spec_string ("system-id", "system-id", "system-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

/**
 * Not implemented yet. This can lead to API changes in future versions.
 */
static GType
gxml_dom_document_type_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GXmlDomDocumentTypeIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_dom_document_type_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType gxml_dom_document_type_type_id;
	gxml_dom_document_type_type_id = g_type_register_static (G_TYPE_INTERFACE, "GXmlDomDocumentType", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (gxml_dom_document_type_type_id, G_TYPE_OBJECT);
	g_type_interface_add_prerequisite (gxml_dom_document_type_type_id, GXML_TYPE_DOM_NODE);
	g_type_interface_add_prerequisite (gxml_dom_document_type_type_id, GXML_TYPE_DOM_CHILD_NODE);
	return gxml_dom_document_type_type_id;
}

GType
gxml_dom_document_type_get_type (void)
{
	static volatile gsize gxml_dom_document_type_type_id__once = 0;
	if (g_once_init_enter (&gxml_dom_document_type_type_id__once)) {
		GType gxml_dom_document_type_type_id;
		gxml_dom_document_type_type_id = gxml_dom_document_type_get_type_once ();
		g_once_init_leave (&gxml_dom_document_type_type_id__once, gxml_dom_document_type_type_id);
	}
	return gxml_dom_document_type_type_id__once;
}

