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

/* GHtmlDocument.vala
 *
 * Copyright (C) 2016  Daniel Espinosa <esodan@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

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

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <gio/gio.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <glib/gi18n-lib.h>
#include "gxml/xlibxml.h"
#include <libxml/xmlerror.h>
#include <libxml/xmlwriter.h>


#define GXML_TYPE_NODE (gxml_node_get_type ())
#define GXML_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_NODE, GXmlNode))
#define GXML_IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_NODE))
#define GXML_NODE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GXML_TYPE_NODE, GXmlNodeIface))

typedef struct _GXmlNode GXmlNode;
typedef struct _GXmlNodeIface GXmlNodeIface;

#define GXML_TYPE_ELEMENT_LIST (gxml_element_list_get_type ())
#define GXML_ELEMENT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_ELEMENT_LIST, GXmlElementList))
#define GXML_ELEMENT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_ELEMENT_LIST, GXmlElementListClass))
#define GXML_IS_ELEMENT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_ELEMENT_LIST))
#define GXML_IS_ELEMENT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_ELEMENT_LIST))
#define GXML_ELEMENT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_ELEMENT_LIST, GXmlElementListClass))

typedef struct _GXmlElementList GXmlElementList;
typedef struct _GXmlElementListClass GXmlElementListClass;

#define GXML_TYPE_NAMESPACE (gxml_namespace_get_type ())
#define GXML_NAMESPACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_NAMESPACE, GXmlNamespace))
#define GXML_IS_NAMESPACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_NAMESPACE))
#define GXML_NAMESPACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GXML_TYPE_NAMESPACE, GXmlNamespaceIface))

typedef struct _GXmlNamespace GXmlNamespace;
typedef struct _GXmlNamespaceIface GXmlNamespaceIface;

#define GXML_TYPE_NODE_TYPE (gxml_node_type_get_type ())

#define GXML_TYPE_DOCUMENT (gxml_document_get_type ())
#define GXML_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_DOCUMENT, GXmlDocument))
#define GXML_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_DOCUMENT))
#define GXML_DOCUMENT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GXML_TYPE_DOCUMENT, GXmlDocumentIface))

typedef struct _GXmlDocument GXmlDocument;
typedef struct _GXmlDocumentIface GXmlDocumentIface;

#define GXML_TYPE_GNODE (gxml_gnode_get_type ())
#define GXML_GNODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GNODE, GXmlGNode))
#define GXML_GNODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GNODE, GXmlGNodeClass))
#define GXML_IS_GNODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GNODE))
#define GXML_IS_GNODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GNODE))
#define GXML_GNODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GNODE, GXmlGNodeClass))

typedef struct _GXmlGNode GXmlGNode;
typedef struct _GXmlGNodeClass GXmlGNodeClass;
typedef struct _GXmlGNodePrivate GXmlGNodePrivate;

#define GXML_TYPE_GDOCUMENT (gxml_gdocument_get_type ())
#define GXML_GDOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GDOCUMENT, GXmlGDocument))
#define GXML_GDOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GDOCUMENT, GXmlGDocumentClass))
#define GXML_IS_GDOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GDOCUMENT))
#define GXML_IS_GDOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GDOCUMENT))
#define GXML_GDOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GDOCUMENT, GXmlGDocumentClass))

typedef struct _GXmlGDocument GXmlGDocument;
typedef struct _GXmlGDocumentClass GXmlGDocumentClass;
typedef struct _GXmlGDocumentPrivate GXmlGDocumentPrivate;
#define _xmlBufferFree0(var) ((var == NULL) ? NULL : (var = (xmlBufferFree (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define GXML_TYPE_GCOMMENT (gxml_gcomment_get_type ())
#define GXML_GCOMMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GCOMMENT, GXmlGComment))
#define GXML_GCOMMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GCOMMENT, GXmlGCommentClass))
#define GXML_IS_GCOMMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GCOMMENT))
#define GXML_IS_GCOMMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GCOMMENT))
#define GXML_GCOMMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GCOMMENT, GXmlGCommentClass))

typedef struct _GXmlGComment GXmlGComment;
typedef struct _GXmlGCommentClass GXmlGCommentClass;

#define GXML_TYPE_GPROCESSING_INSTRUCTION (gxml_gprocessing_instruction_get_type ())
#define GXML_GPROCESSING_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GPROCESSING_INSTRUCTION, GXmlGProcessingInstruction))
#define GXML_GPROCESSING_INSTRUCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GPROCESSING_INSTRUCTION, GXmlGProcessingInstructionClass))
#define GXML_IS_GPROCESSING_INSTRUCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GPROCESSING_INSTRUCTION))
#define GXML_IS_GPROCESSING_INSTRUCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GPROCESSING_INSTRUCTION))
#define GXML_GPROCESSING_INSTRUCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GPROCESSING_INSTRUCTION, GXmlGProcessingInstructionClass))

typedef struct _GXmlGProcessingInstruction GXmlGProcessingInstruction;
typedef struct _GXmlGProcessingInstructionClass GXmlGProcessingInstructionClass;

#define GXML_TYPE_GELEMENT (gxml_gelement_get_type ())
#define GXML_GELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GELEMENT, GXmlGElement))
#define GXML_GELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GELEMENT, GXmlGElementClass))
#define GXML_IS_GELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GELEMENT))
#define GXML_IS_GELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GELEMENT))
#define GXML_GELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GELEMENT, GXmlGElementClass))

typedef struct _GXmlGElement GXmlGElement;
typedef struct _GXmlGElementClass GXmlGElementClass;

#define GXML_TYPE_GTEXT (gxml_gtext_get_type ())
#define GXML_GTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GTEXT, GXmlGText))
#define GXML_GTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GTEXT, GXmlGTextClass))
#define GXML_IS_GTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GTEXT))
#define GXML_IS_GTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GTEXT))
#define GXML_GTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GTEXT, GXmlGTextClass))

typedef struct _GXmlGText GXmlGText;
typedef struct _GXmlGTextClass GXmlGTextClass;

#define GXML_TYPE_GCDATA (gxml_gcdata_get_type ())
#define GXML_GCDATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GCDATA, GXmlGCDATA))
#define GXML_GCDATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GCDATA, GXmlGCDATAClass))
#define GXML_IS_GCDATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GCDATA))
#define GXML_IS_GCDATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GCDATA))
#define GXML_GCDATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GCDATA, GXmlGCDATAClass))

typedef struct _GXmlGCDATA GXmlGCDATA;
typedef struct _GXmlGCDATAClass GXmlGCDATAClass;
#define _xmlFreeTextWriter0(var) ((var == NULL) ? NULL : (var = (xmlFreeTextWriter (var), NULL)))
#define _xmlFreeDoc0(var) ((var == NULL) ? NULL : (var = (xmlFreeDoc (var), NULL)))

#define GXML_TYPE_GHASH_MAP_ATTR (gxml_ghash_map_attr_get_type ())
#define GXML_GHASH_MAP_ATTR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GHASH_MAP_ATTR, GXmlGHashMapAttr))
#define GXML_GHASH_MAP_ATTR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GHASH_MAP_ATTR, GXmlGHashMapAttrClass))
#define GXML_IS_GHASH_MAP_ATTR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GHASH_MAP_ATTR))
#define GXML_IS_GHASH_MAP_ATTR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GHASH_MAP_ATTR))
#define GXML_GHASH_MAP_ATTR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GHASH_MAP_ATTR, GXmlGHashMapAttrClass))

typedef struct _GXmlGHashMapAttr GXmlGHashMapAttr;
typedef struct _GXmlGHashMapAttrClass GXmlGHashMapAttrClass;

#define GXML_TYPE_GLIST_CHILDREN (gxml_glist_children_get_type ())
#define GXML_GLIST_CHILDREN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GLIST_CHILDREN, GXmlGListChildren))
#define GXML_GLIST_CHILDREN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GLIST_CHILDREN, GXmlGListChildrenClass))
#define GXML_IS_GLIST_CHILDREN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GLIST_CHILDREN))
#define GXML_IS_GLIST_CHILDREN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GLIST_CHILDREN))
#define GXML_GLIST_CHILDREN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GLIST_CHILDREN, GXmlGListChildrenClass))

typedef struct _GXmlGListChildren GXmlGListChildren;
typedef struct _GXmlGListChildrenClass GXmlGListChildrenClass;

#define GXML_TYPE_GLIST_NAMESPACES (gxml_glist_namespaces_get_type ())
#define GXML_GLIST_NAMESPACES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GLIST_NAMESPACES, GXmlGListNamespaces))
#define GXML_GLIST_NAMESPACES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GLIST_NAMESPACES, GXmlGListNamespacesClass))
#define GXML_IS_GLIST_NAMESPACES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GLIST_NAMESPACES))
#define GXML_IS_GLIST_NAMESPACES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GLIST_NAMESPACES))
#define GXML_GLIST_NAMESPACES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GLIST_NAMESPACES, GXmlGListNamespacesClass))

typedef struct _GXmlGListNamespaces GXmlGListNamespaces;
typedef struct _GXmlGListNamespacesClass GXmlGListNamespacesClass;

#define GXML_TYPE_ELEMENT (gxml_element_get_type ())
#define GXML_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_ELEMENT, GXmlElement))
#define GXML_IS_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_ELEMENT))
#define GXML_ELEMENT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GXML_TYPE_ELEMENT, GXmlElementIface))

typedef struct _GXmlElement GXmlElement;
typedef struct _GXmlElementIface GXmlElementIface;

struct _GXmlNamespaceIface {
	GTypeInterface parent_iface;
	gchar* (*get_uri) (GXmlNamespace* self);
	gchar* (*get_prefix) (GXmlNamespace* self);
};

typedef enum  {
	GXML_NODE_TYPE_X_UNKNOWN = 0,
	GXML_NODE_TYPE_ELEMENT = 1,
	GXML_NODE_TYPE_ATTRIBUTE,
	GXML_NODE_TYPE_TEXT,
	GXML_NODE_TYPE_CDATA_SECTION,
	GXML_NODE_TYPE_ENTITY_REFERENCE,
	GXML_NODE_TYPE_ENTITY,
	GXML_NODE_TYPE_PROCESSING_INSTRUCTION,
	GXML_NODE_TYPE_COMMENT,
	GXML_NODE_TYPE_DOCUMENT,
	GXML_NODE_TYPE_DOCUMENT_TYPE,
	GXML_NODE_TYPE_DOCUMENT_FRAGMENT,
	GXML_NODE_TYPE_NOTATION
} GXmlNodeType;

struct _GXmlDocumentIface {
	GTypeInterface parent_iface;
	GXmlNode* (*create_element) (GXmlDocument* self, const gchar* name, GError** error);
	GXmlNode* (*create_text) (GXmlDocument* self, const gchar* text);
	GXmlNode* (*create_comment) (GXmlDocument* self, const gchar* text);
	GXmlNode* (*create_cdata) (GXmlDocument* self, const gchar* text);
	GXmlNode* (*create_pi) (GXmlDocument* self, const gchar* target, const gchar* data);
	gboolean (*save) (GXmlDocument* self, GCancellable* cancellable, GError** error);
	gboolean (*save_as) (GXmlDocument* self, GFile* f, GCancellable* cancellable, GError** error);
	gboolean (*get_indent) (GXmlDocument* self);
	void (*set_indent) (GXmlDocument* self, gboolean value);
	gboolean (*get_ns_top) (GXmlDocument* self);
	void (*set_ns_top) (GXmlDocument* self, gboolean value);
	gboolean (*get_prefix_default_ns) (GXmlDocument* self);
	void (*set_prefix_default_ns) (GXmlDocument* self, gboolean value);
	gboolean (*get_backup) (GXmlDocument* self);
	void (*set_backup) (GXmlDocument* self, gboolean value);
	GXmlNode* (*get_root) (GXmlDocument* self);
	GFile* (*get_file) (GXmlDocument* self);
	void (*set_file) (GXmlDocument* self, GFile* value);
};

struct _GXmlNodeIface {
	GTypeInterface parent_iface;
	GXmlNode* (*get) (GXmlNode* self, const gchar* key);
	GXmlElementList* (*get_elements_by_property_value) (GXmlNode* self, const gchar* property, const gchar* value);
	gchar* (*to_string) (GXmlNode* self);
	gboolean (*set_namespace) (GXmlNode* self, const gchar* uri, const gchar* prefix);
	gchar* (*ns_prefix) (GXmlNode* self);
	gchar* (*ns_uri) (GXmlNode* self);
	GeeList* (*get_namespaces) (GXmlNode* self);
	GeeBidirList* (*get_childs) (GXmlNode* self);
	GeeBidirList* (*get_children) (GXmlNode* self);
	GeeMap* (*get_attrs) (GXmlNode* self);
	gchar* (*get_name) (GXmlNode* self);
	gchar* (*get_value) (GXmlNode* self);
	void (*set_value) (GXmlNode* self, const gchar* value);
	GXmlNodeType (*get_type_node) (GXmlNode* self);
	GXmlDocument* (*get_document) (GXmlNode* self);
	GXmlNode* (*get_parent) (GXmlNode* self);
};

struct _GXmlGNode {
	GObject parent_instance;
	GXmlGNodePrivate * priv;
	GXmlGDocument* _doc;
	xmlNode* _node;
};

struct _GXmlGNodeClass {
	GObjectClass parent_class;
	gboolean (*set_namespace) (GXmlGNode* self, const gchar* uri, const gchar* prefix);
	gchar* (*to_string) (GXmlGNode* self);
	GeeMap* (*get_attrs) (GXmlGNode* self);
	GeeBidirList* (*get_children) (GXmlGNode* self);
	GeeList* (*get_namespaces) (GXmlGNode* self);
	GXmlDocument* (*get_document) (GXmlGNode* self);
	GXmlNode* (*get_parent) (GXmlGNode* self);
	GXmlNodeType (*get_type_node) (GXmlGNode* self);
	gchar* (*get_name) (GXmlGNode* self);
	gchar* (*get_value) (GXmlGNode* self);
	void (*set_value) (GXmlGNode* self, const gchar* value);
};

struct _GXmlGDocument {
	GXmlGNode parent_instance;
	GXmlGDocumentPrivate * priv;
	xmlDoc* doc;
	xmlBuffer* _buffer;
};

struct _GXmlGDocumentClass {
	GXmlGNodeClass parent_class;
	gboolean (*save) (GXmlGDocument* self, GCancellable* cancellable, GError** error);
	gboolean (*save_as) (GXmlGDocument* self, GFile* f, GCancellable* cancellable, GError** error);
};

struct _GXmlGDocumentPrivate {
	gboolean _indent;
	gboolean _ns_top;
	gboolean _prefix_default_ns;
	gboolean _backup;
	GFile* _file;
};

typedef enum  {
	GXML_DOCUMENT_ERROR_INVALID_DOCUMENT_ERROR,
	GXML_DOCUMENT_ERROR_INVALID_FILE
} GXmlDocumentError;
#define GXML_DOCUMENT_ERROR gxml_document_error_quark ()
typedef enum  {
	GXML_ERROR_NOT_SUPPORTED,
	GXML_ERROR_PARSER,
	GXML_ERROR_WRITER
} GXmlError;
#define GXML_ERROR gxml_error_quark ()
struct _GXmlElementIface {
	GTypeInterface parent_iface;
	void (*normalize) (GXmlElement* self);
	void (*set_attr) (GXmlElement* self, const gchar* name, const gchar* value);
	GXmlNode* (*get_attr) (GXmlElement* self, const gchar* name);
	void (*remove_attr) (GXmlElement* self, const gchar* name);
	void (*set_ns_attr) (GXmlElement* self, GXmlNamespace* ns, const gchar* name, const gchar* value);
	GXmlNode* (*get_ns_attr) (GXmlElement* self, const gchar* name, const gchar* uri);
	gchar* (*get_tag_name) (GXmlElement* self);
	gchar* (*get_content) (GXmlElement* self);
	void (*set_content) (GXmlElement* self, const gchar* value);
};


static gpointer gxml_gdocument_parent_class = NULL;
static GXmlDocumentIface* gxml_gdocument_gxml_document_parent_iface = NULL;

GType gxml_element_list_get_type (void) G_GNUC_CONST;
GType gxml_namespace_get_type (void) G_GNUC_CONST;
GType gxml_node_type_get_type (void) G_GNUC_CONST;
GType gxml_document_get_type (void) G_GNUC_CONST;
GType gxml_node_get_type (void) G_GNUC_CONST;
GType gxml_gnode_get_type (void) G_GNUC_CONST;
GType gxml_gdocument_get_type (void) G_GNUC_CONST;
#define GXML_GDOCUMENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GXML_TYPE_GDOCUMENT, GXmlGDocumentPrivate))
enum  {
	GXML_GDOCUMENT_DUMMY_PROPERTY,
	GXML_GDOCUMENT_ATTRS,
	GXML_GDOCUMENT_CHILDREN,
	GXML_GDOCUMENT_NAMESPACES,
	GXML_GDOCUMENT_DOCUMENT,
	GXML_GDOCUMENT_INDENT,
	GXML_GDOCUMENT_NS_TOP,
	GXML_GDOCUMENT_PREFIX_DEFAULT_NS,
	GXML_GDOCUMENT_BACKUP,
	GXML_GDOCUMENT_FILE,
	GXML_GDOCUMENT_ROOT
};
GXmlGDocument* gxml_gdocument_new (void);
GXmlGDocument* gxml_gdocument_construct (GType object_type);
GXmlGNode* gxml_gnode_construct (GType object_type);
GXmlGDocument* gxml_gdocument_new_from_path (const gchar* path, gint options, GError** error);
GXmlGDocument* gxml_gdocument_construct_from_path (GType object_type, const gchar* path, gint options, GError** error);
GXmlGDocument* gxml_gdocument_new_from_file (GFile* file, gint options, GCancellable* cancel, GError** error);
GXmlGDocument* gxml_gdocument_construct_from_file (GType object_type, GFile* file, gint options, GCancellable* cancel, GError** error);
GXmlGDocument* gxml_gdocument_new_from_uri (const gchar* uri, gint options, GError** error);
GXmlGDocument* gxml_gdocument_construct_from_uri (GType object_type, const gchar* uri, gint options, GError** error);
GQuark gxml_document_error_quark (void);
GXmlGDocument* gxml_gdocument_new_from_string (const gchar* str, gint options, GError** error);
GXmlGDocument* gxml_gdocument_construct_from_string (GType object_type, const gchar* str, gint options, GError** error);
gchar* gxml_libxml2_error_to_string (xmlError* e);
GQuark gxml_error_quark (void);
GXmlGDocument* gxml_gdocument_new_from_stream (GInputStream* istream, GError** error);
GXmlGDocument* gxml_gdocument_construct_from_stream (GType object_type, GInputStream* istream, GError** error);
GXmlGDocument* gxml_gdocument_new_from_doc (xmlDoc* doc);
GXmlGDocument* gxml_gdocument_construct_from_doc (GType object_type, xmlDoc* doc);
static gboolean gxml_gdocument_real_set_namespace (GXmlGNode* base, const gchar* uri, const gchar* prefix);
static GXmlNode* gxml_gdocument_real_create_comment (GXmlDocument* base, const gchar* text);
GXmlGComment* gxml_gcomment_new (GXmlGDocument* doc, xmlNode* node);
GXmlGComment* gxml_gcomment_construct (GType object_type, GXmlGDocument* doc, xmlNode* node);
GType gxml_gcomment_get_type (void) G_GNUC_CONST;
static GXmlNode* gxml_gdocument_real_create_pi (GXmlDocument* base, const gchar* target, const gchar* data);
GXmlGProcessingInstruction* gxml_gprocessing_instruction_new (GXmlGDocument* doc, xmlNode* node);
GXmlGProcessingInstruction* gxml_gprocessing_instruction_construct (GType object_type, GXmlGDocument* doc, xmlNode* node);
GType gxml_gprocessing_instruction_get_type (void) G_GNUC_CONST;
static GXmlNode* gxml_gdocument_real_create_element (GXmlDocument* base, const gchar* name, GError** error);
GXmlGElement* gxml_gelement_new (GXmlGDocument* doc, xmlNode* node);
GXmlGElement* gxml_gelement_construct (GType object_type, GXmlGDocument* doc, xmlNode* node);
GType gxml_gelement_get_type (void) G_GNUC_CONST;
static GXmlNode* gxml_gdocument_real_create_text (GXmlDocument* base, const gchar* text);
GXmlGText* gxml_gtext_new (GXmlGDocument* doc, xmlNode* node);
GXmlGText* gxml_gtext_construct (GType object_type, GXmlGDocument* doc, xmlNode* node);
GType gxml_gtext_get_type (void) G_GNUC_CONST;
static GXmlNode* gxml_gdocument_real_create_cdata (GXmlDocument* base, const gchar* text);
GXmlGCDATA* gxml_gcdata_new (GXmlGDocument* doc, xmlNode* node);
GXmlGCDATA* gxml_gcdata_construct (GType object_type, GXmlGDocument* doc, xmlNode* node);
GType gxml_gcdata_get_type (void) G_GNUC_CONST;
static gchar* gxml_gdocument_real_to_string (GXmlGNode* base);
void gxml_tdocument_write_document (GXmlDocument* doc, xmlTextWriter* tw, GError** error);
gchar* gxml_gdocument_libxml_to_string (GXmlGDocument* self);
gboolean gxml_gdocument_save (GXmlGDocument* self, GCancellable* cancellable, GError** error);
static gboolean gxml_gdocument_real_save (GXmlGDocument* self, GCancellable* cancellable, GError** error);
gboolean gxml_gdocument_save_as (GXmlGDocument* self, GFile* f, GCancellable* cancellable, GError** error);
GFile* gxml_document_get_file (GXmlDocument* self);
static gboolean gxml_gdocument_real_save_as (GXmlGDocument* self, GFile* f, GCancellable* cancellable, GError** error);
gboolean gxml_tdocument_tw_save_as (GXmlDocument* doc, GFile* f, GCancellable* cancellable, GError** error);
GXmlGHashMapAttr* gxml_ghash_map_attr_new (GXmlGDocument* doc, xmlNode* node);
GXmlGHashMapAttr* gxml_ghash_map_attr_construct (GType object_type, GXmlGDocument* doc, xmlNode* node);
GType gxml_ghash_map_attr_get_type (void) G_GNUC_CONST;
GXmlGListChildren* gxml_glist_children_new (GXmlGDocument* doc, xmlNode* node);
GXmlGListChildren* gxml_glist_children_construct (GType object_type, GXmlGDocument* doc, xmlNode* node);
GType gxml_glist_children_get_type (void) G_GNUC_CONST;
GXmlGListNamespaces* gxml_glist_namespaces_new (GXmlGDocument* doc, xmlNode* node);
GXmlGListNamespaces* gxml_glist_namespaces_construct (GType object_type, GXmlGDocument* doc, xmlNode* node);
GType gxml_glist_namespaces_get_type (void) G_GNUC_CONST;
GeeBidirList* gxml_node_get_childs (GXmlNode* self);
GType gxml_element_get_type (void) G_GNUC_CONST;
static void gxml_gdocument_finalize (GObject* obj);
GeeMap* gxml_gnode_get_attrs (GXmlGNode* self);
GeeBidirList* gxml_gnode_get_children (GXmlGNode* self);
GeeList* gxml_gnode_get_namespaces (GXmlGNode* self);
GXmlDocument* gxml_gnode_get_document (GXmlGNode* self);
gboolean gxml_document_get_indent (GXmlDocument* self);
gboolean gxml_document_get_ns_top (GXmlDocument* self);
gboolean gxml_document_get_prefix_default_ns (GXmlDocument* self);
gboolean gxml_document_get_backup (GXmlDocument* self);
GXmlNode* gxml_document_get_root (GXmlDocument* self);
static void _vala_gxml_gdocument_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
void gxml_document_set_indent (GXmlDocument* self, gboolean value);
void gxml_document_set_ns_top (GXmlDocument* self, gboolean value);
void gxml_document_set_prefix_default_ns (GXmlDocument* self, gboolean value);
void gxml_document_set_backup (GXmlDocument* self, gboolean value);
void gxml_document_set_file (GXmlDocument* self, GFile* value);
static void _vala_gxml_gdocument_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


GXmlGDocument* gxml_gdocument_construct (GType object_type) {
	GXmlGDocument * self = NULL;
	xmlDoc* _tmp0_ = NULL;
	self = (GXmlGDocument*) gxml_gnode_construct (object_type);
	_tmp0_ = xmlNewDoc ((xmlChar*) NULL);
	self->doc = _tmp0_;
	return self;
}


GXmlGDocument* gxml_gdocument_new (void) {
	return gxml_gdocument_construct (GXML_TYPE_GDOCUMENT);
}


GXmlGDocument* gxml_gdocument_construct_from_path (GType object_type, const gchar* path, gint options, GError** error) {
	GXmlGDocument * self = NULL;
	const gchar* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	GFile* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = path;
	_tmp1_ = g_file_new_for_path (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = options;
	self = (GXmlGDocument*) gxml_gdocument_construct_from_file (object_type, _tmp2_, _tmp3_, NULL, &_inner_error_);
	_g_object_unref0 (_tmp2_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (self);
		return NULL;
	}
	return self;
}


GXmlGDocument* gxml_gdocument_new_from_path (const gchar* path, gint options, GError** error) {
	return gxml_gdocument_construct_from_path (GXML_TYPE_GDOCUMENT, path, options, error);
}


GXmlGDocument* gxml_gdocument_construct_from_uri (GType object_type, const gchar* uri, gint options, GError** error) {
	GXmlGDocument * self = NULL;
	const gchar* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	GFile* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (uri != NULL, NULL);
	_tmp0_ = uri;
	_tmp1_ = g_file_new_for_uri (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = options;
	self = (GXmlGDocument*) gxml_gdocument_construct_from_file (object_type, _tmp2_, _tmp3_, NULL, &_inner_error_);
	_g_object_unref0 (_tmp2_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (self);
		return NULL;
	}
	return self;
}


GXmlGDocument* gxml_gdocument_new_from_uri (const gchar* uri, gint options, GError** error) {
	return gxml_gdocument_construct_from_uri (GXML_TYPE_GDOCUMENT, uri, options, error);
}


GXmlGDocument* gxml_gdocument_construct_from_file (GType object_type, GFile* file, gint options, GCancellable* cancel, GError** error) {
	GXmlGDocument * self = NULL;
	GFile* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	GMemoryOutputStream* b = NULL;
	GMemoryOutputStream* _tmp4_ = NULL;
	GFileInputStream* _tmp5_ = NULL;
	GFile* _tmp6_ = NULL;
	GFileInputStream* _tmp7_ = NULL;
	GMemoryOutputStream* _tmp8_ = NULL;
	GMemoryOutputStream* _tmp9_ = NULL;
	void* _tmp10_ = NULL;
	void* _tmp11_ = NULL;
	gint _tmp12_ = 0;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (file != NULL, NULL);
	_tmp0_ = file;
	_tmp1_ = g_file_query_exists (_tmp0_, NULL);
	if (!_tmp1_) {
		const gchar* _tmp2_ = NULL;
		GError* _tmp3_ = NULL;
		_tmp2_ = _ ("File doesn't exist");
		_tmp3_ = g_error_new_literal (GXML_DOCUMENT_ERROR, GXML_DOCUMENT_ERROR_INVALID_DOCUMENT_ERROR, _tmp2_);
		_inner_error_ = _tmp3_;
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp4_ = (GMemoryOutputStream*) g_memory_output_stream_new_resizable ();
	b = _tmp4_;
	_tmp6_ = file;
	_tmp7_ = g_file_read (_tmp6_, NULL, &_inner_error_);
	_tmp5_ = _tmp7_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (b);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp8_ = b;
	g_output_stream_splice ((GOutputStream*) _tmp8_, (GInputStream*) _tmp5_, 0, NULL, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (_tmp5_);
		_g_object_unref0 (b);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp9_ = b;
	_tmp10_ = g_memory_output_stream_get_data (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = options;
	self = (GXmlGDocument*) gxml_gdocument_construct_from_string (object_type, (const gchar*) _tmp11_, _tmp12_, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (_tmp5_);
		_g_object_unref0 (b);
		_g_object_unref0 (self);
		return NULL;
	}
	_g_object_unref0 (_tmp5_);
	_g_object_unref0 (b);
	return self;
}


GXmlGDocument* gxml_gdocument_new_from_file (GFile* file, gint options, GCancellable* cancel, GError** error) {
	return gxml_gdocument_construct_from_file (GXML_TYPE_GDOCUMENT, file, options, cancel, error);
}


GXmlGDocument* gxml_gdocument_construct_from_string (GType object_type, const gchar* str, gint options, GError** error) {
	GXmlGDocument * self = NULL;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	xmlDoc* _tmp4_ = NULL;
	xmlError* e = NULL;
	xmlError* _tmp5_ = NULL;
	xmlError* _tmp6_ = NULL;
	xmlDoc* _tmp14_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (str != NULL, NULL);
	self = (GXmlGDocument*) gxml_gnode_construct (object_type);
	gxml_reset_last_error ();
	_tmp0_ = str;
	_tmp1_ = str;
	_tmp2_ = strlen (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = xmlParseMemory (_tmp0_, (gint) _tmp3_);
	self->doc = _tmp4_;
	_tmp5_ = gxml_get_last_error ();
	e = _tmp5_;
	_tmp6_ = e;
	if (_tmp6_ != NULL) {
		gchar* errmsg = NULL;
		gchar* _tmp7_ = NULL;
		gchar* s = NULL;
		xmlError* _tmp8_ = NULL;
		gchar* _tmp9_ = NULL;
		const gchar* _tmp10_ = NULL;
		const gchar* _tmp12_ = NULL;
		GError* _tmp13_ = NULL;
		_tmp7_ = g_strdup ("Parser Error for string");
		errmsg = _tmp7_;
		_tmp8_ = e;
		_tmp9_ = gxml_libxml2_error_to_string (_tmp8_);
		s = _tmp9_;
		_tmp10_ = s;
		if (_tmp10_ != NULL) {
			gchar* _tmp11_ = NULL;
			_tmp11_ = g_strdup (".  ");
			_g_free0 (errmsg);
			errmsg = _tmp11_;
		}
		_tmp12_ = errmsg;
		_tmp13_ = g_error_new_literal (GXML_ERROR, GXML_ERROR_PARSER, _tmp12_);
		_inner_error_ = _tmp13_;
		g_propagate_error (error, _inner_error_);
		_g_free0 (s);
		_g_free0 (errmsg);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp14_ = self->doc;
	if (_tmp14_ == NULL) {
		xmlDoc* _tmp15_ = NULL;
		_tmp15_ = xmlNewDoc ((xmlChar*) NULL);
		self->doc = _tmp15_;
	}
	return self;
}


GXmlGDocument* gxml_gdocument_new_from_string (const gchar* str, gint options, GError** error) {
	return gxml_gdocument_construct_from_string (GXML_TYPE_GDOCUMENT, str, options, error);
}


GXmlGDocument* gxml_gdocument_construct_from_stream (GType object_type, GInputStream* istream, GError** error) {
	GXmlGDocument * self = NULL;
	GMemoryOutputStream* b = NULL;
	GMemoryOutputStream* _tmp0_ = NULL;
	GMemoryOutputStream* _tmp1_ = NULL;
	GInputStream* _tmp2_ = NULL;
	GMemoryOutputStream* _tmp3_ = NULL;
	void* _tmp4_ = NULL;
	void* _tmp5_ = NULL;
	GMemoryOutputStream* _tmp8_ = NULL;
	void* _tmp9_ = NULL;
	void* _tmp10_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (istream != NULL, NULL);
	_tmp0_ = (GMemoryOutputStream*) g_memory_output_stream_new_resizable ();
	b = _tmp0_;
	_tmp1_ = b;
	_tmp2_ = istream;
	g_output_stream_splice ((GOutputStream*) _tmp1_, _tmp2_, 0, NULL, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (b);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp3_ = b;
	_tmp4_ = g_memory_output_stream_get_data (_tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == NULL) {
		const gchar* _tmp6_ = NULL;
		GError* _tmp7_ = NULL;
		_tmp6_ = _ ("stream doesn't provide data");
		_tmp7_ = g_error_new_literal (GXML_DOCUMENT_ERROR, GXML_DOCUMENT_ERROR_INVALID_DOCUMENT_ERROR, _tmp6_);
		_inner_error_ = _tmp7_;
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (b);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp8_ = b;
	_tmp9_ = g_memory_output_stream_get_data (_tmp8_);
	_tmp10_ = _tmp9_;
	self = (GXmlGDocument*) gxml_gdocument_construct_from_string (object_type, (const gchar*) _tmp10_, 0, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (b);
		_g_object_unref0 (self);
		return NULL;
	}
	_g_object_unref0 (b);
	return self;
}


GXmlGDocument* gxml_gdocument_new_from_stream (GInputStream* istream, GError** error) {
	return gxml_gdocument_construct_from_stream (GXML_TYPE_GDOCUMENT, istream, error);
}


GXmlGDocument* gxml_gdocument_construct_from_doc (GType object_type, xmlDoc* doc) {
	GXmlGDocument * self = NULL;
	xmlDoc* _tmp0_ = NULL;
	g_return_val_if_fail (doc != NULL, NULL);
	self = (GXmlGDocument*) gxml_gnode_construct (object_type);
	_tmp0_ = doc;
	self->doc = _tmp0_;
	return self;
}


GXmlGDocument* gxml_gdocument_new_from_doc (xmlDoc* doc) {
	return gxml_gdocument_construct_from_doc (GXML_TYPE_GDOCUMENT, doc);
}


static gboolean gxml_gdocument_real_set_namespace (GXmlGNode* base, const gchar* uri, const gchar* prefix) {
	GXmlGDocument * self;
	gboolean result = FALSE;
	xmlNode* root = NULL;
	xmlDoc* _tmp0_ = NULL;
	xmlNode* _tmp1_ = NULL;
	xmlNode* _tmp2_ = NULL;
	self = (GXmlGDocument*) base;
	g_return_val_if_fail (uri != NULL, FALSE);
	_tmp0_ = self->doc;
	_tmp1_ = xmlDocGetRootElement (_tmp0_);
	root = _tmp1_;
	_tmp2_ = root;
	if (_tmp2_ != NULL) {
		xmlNs* ns = NULL;
		xmlNode* _tmp3_ = NULL;
		const gchar* _tmp4_ = NULL;
		const gchar* _tmp5_ = NULL;
		xmlNs* _tmp6_ = NULL;
		xmlNs* _tmp7_ = NULL;
		_tmp3_ = root;
		_tmp4_ = uri;
		_tmp5_ = prefix;
		_tmp6_ = xmlNewNs (_tmp3_, (xmlChar*) _tmp4_, (xmlChar*) _tmp5_);
		ns = _tmp6_;
		_tmp7_ = ns;
		result = _tmp7_ != NULL;
		return result;
	}
	result = FALSE;
	return result;
}


static GXmlNode* gxml_gdocument_real_create_comment (GXmlDocument* base, const gchar* text) {
	GXmlGDocument * self;
	GXmlNode* result = NULL;
	xmlNode* c = NULL;
	xmlDoc* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	xmlNode* _tmp2_ = NULL;
	GXmlGComment* _tmp3_ = NULL;
	self = (GXmlGDocument*) base;
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = self->doc;
	_tmp1_ = text;
	_tmp2_ = xmlNewDocComment (_tmp0_, (xmlChar*) _tmp1_);
	c = _tmp2_;
	_tmp3_ = gxml_gcomment_new (self, c);
	result = (GXmlNode*) _tmp3_;
	return result;
}


static GXmlNode* gxml_gdocument_real_create_pi (GXmlDocument* base, const gchar* target, const gchar* data) {
	GXmlGDocument * self;
	GXmlNode* result = NULL;
	xmlNode* pi = NULL;
	xmlDoc* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	xmlNode* _tmp3_ = NULL;
	GXmlGProcessingInstruction* _tmp4_ = NULL;
	self = (GXmlGDocument*) base;
	g_return_val_if_fail (target != NULL, NULL);
	g_return_val_if_fail (data != NULL, NULL);
	_tmp0_ = self->doc;
	_tmp1_ = target;
	_tmp2_ = data;
	_tmp3_ = xmlNewDocPI (_tmp0_, (xmlChar*) _tmp1_, (xmlChar*) _tmp2_);
	pi = _tmp3_;
	_tmp4_ = gxml_gprocessing_instruction_new (self, pi);
	result = (GXmlNode*) _tmp4_;
	return result;
}


static GXmlNode* gxml_gdocument_real_create_element (GXmlDocument* base, const gchar* name, GError** error) {
	GXmlGDocument * self;
	GXmlNode* result = NULL;
	xmlNode* el = NULL;
	xmlDoc* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	xmlNode* _tmp2_ = NULL;
	xmlError* e = NULL;
	xmlError* _tmp3_ = NULL;
	xmlError* _tmp4_ = NULL;
	xmlNode* _tmp12_ = NULL;
	GXmlGElement* _tmp13_ = NULL;
	GError * _inner_error_ = NULL;
	self = (GXmlGDocument*) base;
	g_return_val_if_fail (name != NULL, NULL);
	gxml_reset_last_error ();
	_tmp0_ = self->doc;
	_tmp1_ = name;
	_tmp2_ = xmlNewDocRawNode (_tmp0_, NULL, (xmlChar*) _tmp1_, (xmlChar*) NULL);
	el = _tmp2_;
	_tmp3_ = gxml_get_last_error ();
	e = _tmp3_;
	_tmp4_ = e;
	if (_tmp4_ != NULL) {
		gchar* errmsg = NULL;
		gchar* _tmp5_ = NULL;
		gchar* s = NULL;
		xmlError* _tmp6_ = NULL;
		gchar* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		const gchar* _tmp10_ = NULL;
		GError* _tmp11_ = NULL;
		_tmp5_ = g_strdup ("Parser Error for string");
		errmsg = _tmp5_;
		_tmp6_ = e;
		_tmp7_ = gxml_libxml2_error_to_string (_tmp6_);
		s = _tmp7_;
		_tmp8_ = s;
		if (_tmp8_ != NULL) {
			gchar* _tmp9_ = NULL;
			_tmp9_ = g_strdup (".  ");
			_g_free0 (errmsg);
			errmsg = _tmp9_;
		}
		_tmp10_ = errmsg;
		_tmp11_ = g_error_new_literal (GXML_ERROR, GXML_ERROR_PARSER, _tmp10_);
		_inner_error_ = _tmp11_;
		g_propagate_error (error, _inner_error_);
		_g_free0 (s);
		_g_free0 (errmsg);
		return NULL;
	}
	_tmp12_ = el;
	_tmp13_ = gxml_gelement_new (self, _tmp12_);
	result = (GXmlNode*) _tmp13_;
	return result;
}


static GXmlNode* gxml_gdocument_real_create_text (GXmlDocument* base, const gchar* text) {
	GXmlGDocument * self;
	GXmlNode* result = NULL;
	xmlNode* t = NULL;
	xmlDoc* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	xmlNode* _tmp2_ = NULL;
	GXmlGText* _tmp3_ = NULL;
	self = (GXmlGDocument*) base;
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = self->doc;
	_tmp1_ = text;
	_tmp2_ = xmlNewDocText (_tmp0_, (xmlChar*) _tmp1_);
	t = _tmp2_;
	_tmp3_ = gxml_gtext_new (self, t);
	result = (GXmlNode*) _tmp3_;
	return result;
}


static GXmlNode* gxml_gdocument_real_create_cdata (GXmlDocument* base, const gchar* text) {
	GXmlGDocument * self;
	GXmlNode* result = NULL;
	xmlNode* cd = NULL;
	xmlDoc* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	gint _tmp4_ = 0;
	xmlNode* _tmp5_ = NULL;
	GXmlGCDATA* _tmp6_ = NULL;
	self = (GXmlGDocument*) base;
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = self->doc;
	_tmp1_ = text;
	_tmp2_ = text;
	_tmp3_ = strlen (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = xmlNewCDataBlock (_tmp0_, (xmlChar*) _tmp1_, _tmp4_);
	cd = _tmp5_;
	_tmp6_ = gxml_gcdata_new (self, cd);
	result = (GXmlNode*) _tmp6_;
	return result;
}


static gchar* gxml_gdocument_real_to_string (GXmlGNode* base) {
	GXmlGDocument * self;
	gchar* result = NULL;
	xmlDoc* doc = NULL;
	xmlDoc* _tmp0_ = NULL;
	xmlTextWriter* tw = NULL;
	xmlTextWriter* _tmp1_ = NULL;
	gchar* str = NULL;
	gint size = 0;
	xmlDoc* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	GError * _inner_error_ = NULL;
	self = (GXmlGDocument*) base;
	_tmp0_ = xmlNewDoc ((xmlChar*) NULL);
	doc = _tmp0_;
	_tmp1_ = gxml_new_text_writer_doc (&doc);
	tw = _tmp1_;
	gxml_tdocument_write_document ((GXmlDocument*) self, tw, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_xmlFreeTextWriter0 (tw);
		_xmlFreeDoc0 (doc);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	_tmp2_ = doc;
	xmlDocDumpMemory (_tmp2_, (xmlChar**) (&_tmp3_), &_tmp4_);
	_g_free0 (str);
	str = _tmp3_;
	size = _tmp4_;
	result = str;
	_xmlFreeTextWriter0 (tw);
	_xmlFreeDoc0 (doc);
	return result;
}


/**
   * Uses libxml2 internal dump to memory function over owned 
   */
gchar* gxml_gdocument_libxml_to_string (GXmlGDocument* self) {
	gchar* result = NULL;
	gchar* buffer = NULL;
	xmlDoc* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->doc;
	xmlDocDumpMemory (_tmp0_, (xmlChar**) (&_tmp1_), NULL);
	_g_free0 (buffer);
	buffer = _tmp1_;
	_tmp2_ = g_strdup (buffer);
	result = _tmp2_;
	_g_free0 (buffer);
	return result;
}


static gboolean gxml_gdocument_real_save (GXmlGDocument* self, GCancellable* cancellable, GError** error) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	GFile* _tmp1_ = NULL;
	GFile* _tmp2_ = NULL;
	GCancellable* _tmp3_ = NULL;
	gboolean _tmp4_ = FALSE;
	GError * _inner_error_ = NULL;
	_tmp1_ = gxml_document_get_file ((GXmlDocument*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = cancellable;
	_tmp4_ = gxml_gdocument_save_as (self, _tmp2_, _tmp3_, &_inner_error_);
	_tmp0_ = _tmp4_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		return FALSE;
	}
	result = _tmp0_;
	return result;
}


gboolean gxml_gdocument_save (GXmlGDocument* self, GCancellable* cancellable, GError** error) {
	g_return_val_if_fail (self != NULL, FALSE);
	return GXML_GDOCUMENT_GET_CLASS (self)->save (self, cancellable, error);
}


static gboolean gxml_gdocument_real_save_as (GXmlGDocument* self, GFile* f, GCancellable* cancellable, GError** error) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	GFile* _tmp1_ = NULL;
	GCancellable* _tmp2_ = NULL;
	gboolean _tmp3_ = FALSE;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (f != NULL, FALSE);
	_tmp1_ = f;
	_tmp2_ = cancellable;
	_tmp3_ = gxml_tdocument_tw_save_as ((GXmlDocument*) self, _tmp1_, _tmp2_, &_inner_error_);
	_tmp0_ = _tmp3_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		return FALSE;
	}
	result = _tmp0_;
	return result;
}


gboolean gxml_gdocument_save_as (GXmlGDocument* self, GFile* f, GCancellable* cancellable, GError** error) {
	g_return_val_if_fail (self != NULL, FALSE);
	return GXML_GDOCUMENT_GET_CLASS (self)->save_as (self, f, cancellable, error);
}


static GeeMap* gxml_gdocument_real_get_attrs (GXmlGNode* base) {
	GeeMap* result;
	GXmlGDocument* self;
	xmlDoc* _tmp0_ = NULL;
	GXmlGHashMapAttr* _tmp1_ = NULL;
	self = (GXmlGDocument*) base;
	_tmp0_ = self->doc;
	_tmp1_ = gxml_ghash_map_attr_new (self, (xmlNode*) _tmp0_);
	result = (GeeMap*) _tmp1_;
	return result;
}


static GeeBidirList* gxml_gdocument_real_get_children (GXmlGNode* base) {
	GeeBidirList* result;
	GXmlGDocument* self;
	xmlDoc* _tmp0_ = NULL;
	GXmlGListChildren* _tmp1_ = NULL;
	self = (GXmlGDocument*) base;
	_tmp0_ = self->doc;
	_tmp1_ = gxml_glist_children_new (self, (xmlNode*) _tmp0_);
	result = (GeeBidirList*) _tmp1_;
	return result;
}


static GeeList* gxml_gdocument_real_get_namespaces (GXmlGNode* base) {
	GeeList* result;
	GXmlGDocument* self;
	xmlDoc* _tmp0_ = NULL;
	GXmlGListNamespaces* _tmp1_ = NULL;
	self = (GXmlGDocument*) base;
	_tmp0_ = self->doc;
	_tmp1_ = gxml_glist_namespaces_new (self, (xmlNode*) _tmp0_);
	result = (GeeList*) _tmp1_;
	return result;
}


static GXmlDocument* gxml_gdocument_real_get_document (GXmlGNode* base) {
	GXmlDocument* result;
	GXmlGDocument* self;
	self = (GXmlGDocument*) base;
	result = (GXmlDocument*) self;
	return result;
}


static gboolean gxml_gdocument_real_get_indent (GXmlDocument* base) {
	gboolean result;
	GXmlGDocument* self;
	gboolean _tmp0_ = FALSE;
	self = (GXmlGDocument*) base;
	_tmp0_ = self->priv->_indent;
	result = _tmp0_;
	return result;
}


static void gxml_gdocument_real_set_indent (GXmlDocument* base, gboolean value) {
	GXmlGDocument* self;
	gboolean _tmp0_ = FALSE;
	self = (GXmlGDocument*) base;
	_tmp0_ = value;
	self->priv->_indent = _tmp0_;
	g_object_notify ((GObject *) self, "indent");
}


static gboolean gxml_gdocument_real_get_ns_top (GXmlDocument* base) {
	gboolean result;
	GXmlGDocument* self;
	gboolean _tmp0_ = FALSE;
	self = (GXmlGDocument*) base;
	_tmp0_ = self->priv->_ns_top;
	result = _tmp0_;
	return result;
}


static void gxml_gdocument_real_set_ns_top (GXmlDocument* base, gboolean value) {
	GXmlGDocument* self;
	gboolean _tmp0_ = FALSE;
	self = (GXmlGDocument*) base;
	_tmp0_ = value;
	self->priv->_ns_top = _tmp0_;
	g_object_notify ((GObject *) self, "ns-top");
}


static gboolean gxml_gdocument_real_get_prefix_default_ns (GXmlDocument* base) {
	gboolean result;
	GXmlGDocument* self;
	gboolean _tmp0_ = FALSE;
	self = (GXmlGDocument*) base;
	_tmp0_ = self->priv->_prefix_default_ns;
	result = _tmp0_;
	return result;
}


static void gxml_gdocument_real_set_prefix_default_ns (GXmlDocument* base, gboolean value) {
	GXmlGDocument* self;
	gboolean _tmp0_ = FALSE;
	self = (GXmlGDocument*) base;
	_tmp0_ = value;
	self->priv->_prefix_default_ns = _tmp0_;
	g_object_notify ((GObject *) self, "prefix-default-ns");
}


static gboolean gxml_gdocument_real_get_backup (GXmlDocument* base) {
	gboolean result;
	GXmlGDocument* self;
	gboolean _tmp0_ = FALSE;
	self = (GXmlGDocument*) base;
	_tmp0_ = self->priv->_backup;
	result = _tmp0_;
	return result;
}


static void gxml_gdocument_real_set_backup (GXmlDocument* base, gboolean value) {
	GXmlGDocument* self;
	gboolean _tmp0_ = FALSE;
	self = (GXmlGDocument*) base;
	_tmp0_ = value;
	self->priv->_backup = _tmp0_;
	g_object_notify ((GObject *) self, "backup");
}


static GFile* gxml_gdocument_real_get_file (GXmlDocument* base) {
	GFile* result;
	GXmlGDocument* self;
	GFile* _tmp0_ = NULL;
	self = (GXmlGDocument*) base;
	_tmp0_ = self->priv->_file;
	result = _tmp0_;
	return result;
}


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


static void gxml_gdocument_real_set_file (GXmlDocument* base, GFile* value) {
	GXmlGDocument* self;
	GFile* _tmp0_ = NULL;
	GFile* _tmp1_ = NULL;
	self = (GXmlGDocument*) base;
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_file);
	self->priv->_file = _tmp1_;
	g_object_notify ((GObject *) self, "file");
}


static GXmlNode* gxml_gdocument_real_get_root (GXmlDocument* base) {
	GXmlNode* result;
	GXmlGDocument* self;
	xmlNode* r = NULL;
	xmlDoc* _tmp0_ = NULL;
	xmlNode* _tmp1_ = NULL;
	xmlNode* _tmp2_ = NULL;
	xmlNode* _tmp22_ = NULL;
	GXmlGElement* _tmp23_ = NULL;
	self = (GXmlGDocument*) base;
	_tmp0_ = self->doc;
	_tmp1_ = xmlDocGetRootElement (_tmp0_);
	r = _tmp1_;
	_tmp2_ = r;
	if (_tmp2_ == NULL) {
		gint found = 0;
		gint _tmp21_ = 0;
		found = 0;
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp3_ = FALSE;
				_tmp3_ = TRUE;
				while (TRUE) {
					gint _tmp5_ = 0;
					GeeBidirList* _tmp6_ = NULL;
					GeeBidirList* _tmp7_ = NULL;
					GeeBidirList* _tmp8_ = NULL;
					gint _tmp9_ = 0;
					gint _tmp10_ = 0;
					gboolean _tmp11_ = FALSE;
					GXmlNode* n = NULL;
					GeeBidirList* _tmp12_ = NULL;
					GeeBidirList* _tmp13_ = NULL;
					GeeBidirList* _tmp14_ = NULL;
					gint _tmp15_ = 0;
					gpointer _tmp16_ = NULL;
					GXmlNode* _tmp17_ = NULL;
					GXmlNode* _tmp18_ = NULL;
					if (!_tmp3_) {
						gint _tmp4_ = 0;
						_tmp4_ = i;
						i = _tmp4_ + 1;
					}
					_tmp3_ = FALSE;
					_tmp5_ = i;
					_tmp6_ = gxml_node_get_childs ((GXmlNode*) self);
					_tmp7_ = _tmp6_;
					_tmp8_ = _tmp7_;
					_tmp9_ = gee_collection_get_size ((GeeCollection*) _tmp8_);
					_tmp10_ = _tmp9_;
					_tmp11_ = !(_tmp5_ < _tmp10_);
					_g_object_unref0 (_tmp8_);
					if (_tmp11_) {
						break;
					}
					_tmp12_ = gxml_node_get_childs ((GXmlNode*) self);
					_tmp13_ = _tmp12_;
					_tmp14_ = _tmp13_;
					_tmp15_ = i;
					_tmp16_ = gee_list_get ((GeeList*) _tmp14_, _tmp15_);
					_tmp17_ = (GXmlNode*) _tmp16_;
					_g_object_unref0 (_tmp14_);
					n = _tmp17_;
					_tmp18_ = n;
					if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp18_, GXML_TYPE_ELEMENT)) {
						gint _tmp19_ = 0;
						gint _tmp20_ = 0;
						_tmp19_ = found;
						found = _tmp19_ + 1;
						_tmp20_ = found;
						if (_tmp20_ == 1) {
							result = n;
							return result;
						}
					}
					_g_object_unref0 (n);
				}
			}
		}
		_tmp21_ = found;
		if (_tmp21_ > 1) {
			g_warning ("GXmlDocument.vala:112: Document have more than one root GXmlElement. U" \
"sing first found");
		}
	}
	_tmp22_ = r;
	_tmp23_ = gxml_gelement_new (self, _tmp22_);
	result = (GXmlNode*) _tmp23_;
	return result;
}


static void gxml_gdocument_class_init (GXmlGDocumentClass * klass) {
	gxml_gdocument_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GXmlGDocumentPrivate));
	((GXmlGNodeClass *) klass)->set_namespace = gxml_gdocument_real_set_namespace;
	((GXmlGNodeClass *) klass)->to_string = gxml_gdocument_real_to_string;
	((GXmlGDocumentClass *) klass)->save = gxml_gdocument_real_save;
	((GXmlGDocumentClass *) klass)->save_as = gxml_gdocument_real_save_as;
	GXML_GNODE_CLASS (klass)->get_attrs = gxml_gdocument_real_get_attrs;
	GXML_GNODE_CLASS (klass)->get_children = gxml_gdocument_real_get_children;
	GXML_GNODE_CLASS (klass)->get_namespaces = gxml_gdocument_real_get_namespaces;
	GXML_GNODE_CLASS (klass)->get_document = gxml_gdocument_real_get_document;
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_gdocument_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gxml_gdocument_set_property;
	G_OBJECT_CLASS (klass)->finalize = gxml_gdocument_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GDOCUMENT_ATTRS, g_param_spec_object ("attrs", "attrs", "attrs", GEE_TYPE_MAP, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GDOCUMENT_CHILDREN, g_param_spec_object ("children", "children", "children", GEE_TYPE_BIDIR_LIST, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GDOCUMENT_NAMESPACES, g_param_spec_object ("namespaces", "namespaces", "namespaces", GEE_TYPE_LIST, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GDOCUMENT_DOCUMENT, g_param_spec_object ("document", "document", "document", GXML_TYPE_DOCUMENT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GDOCUMENT_INDENT, g_param_spec_boolean ("indent", "indent", "indent", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GDOCUMENT_NS_TOP, g_param_spec_boolean ("ns-top", "ns-top", "ns-top", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GDOCUMENT_PREFIX_DEFAULT_NS, g_param_spec_boolean ("prefix-default-ns", "prefix-default-ns", "prefix-default-ns", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GDOCUMENT_BACKUP, g_param_spec_boolean ("backup", "backup", "backup", TRUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GDOCUMENT_FILE, g_param_spec_object ("file", "file", "file", G_TYPE_FILE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GDOCUMENT_ROOT, g_param_spec_object ("root", "root", "root", GXML_TYPE_NODE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void gxml_gdocument_gxml_document_interface_init (GXmlDocumentIface * iface) {
	gxml_gdocument_gxml_document_parent_iface = g_type_interface_peek_parent (iface);
	iface->create_comment = (GXmlNode* (*)(GXmlDocument*, const gchar*)) gxml_gdocument_real_create_comment;
	iface->create_pi = (GXmlNode* (*)(GXmlDocument*, const gchar*, const gchar*)) gxml_gdocument_real_create_pi;
	iface->create_element = (GXmlNode* (*)(GXmlDocument*, const gchar*, GError**)) gxml_gdocument_real_create_element;
	iface->create_text = (GXmlNode* (*)(GXmlDocument*, const gchar*)) gxml_gdocument_real_create_text;
	iface->create_cdata = (GXmlNode* (*)(GXmlDocument*, const gchar*)) gxml_gdocument_real_create_cdata;
	iface->save = (gboolean (*)(GXmlDocument*, GCancellable*, GError**)) gxml_gdocument_save;
	iface->save_as = (gboolean (*)(GXmlDocument*, GFile*, GCancellable*, GError**)) gxml_gdocument_save_as;
	iface->get_indent = gxml_gdocument_real_get_indent;
	iface->set_indent = gxml_gdocument_real_set_indent;
	iface->get_ns_top = gxml_gdocument_real_get_ns_top;
	iface->set_ns_top = gxml_gdocument_real_set_ns_top;
	iface->get_prefix_default_ns = gxml_gdocument_real_get_prefix_default_ns;
	iface->set_prefix_default_ns = gxml_gdocument_real_set_prefix_default_ns;
	iface->get_backup = gxml_gdocument_real_get_backup;
	iface->set_backup = gxml_gdocument_real_set_backup;
	iface->get_file = gxml_gdocument_real_get_file;
	iface->set_file = gxml_gdocument_real_set_file;
	iface->get_root = gxml_gdocument_real_get_root;
}


static void gxml_gdocument_instance_init (GXmlGDocument * self) {
	self->priv = GXML_GDOCUMENT_GET_PRIVATE (self);
	self->priv->_indent = FALSE;
	self->priv->_ns_top = FALSE;
	self->priv->_prefix_default_ns = FALSE;
	self->priv->_backup = TRUE;
}


static void gxml_gdocument_finalize (GObject* obj) {
	GXmlGDocument * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_GDOCUMENT, GXmlGDocument);
	_xmlBufferFree0 (self->_buffer);
	_g_object_unref0 (self->priv->_file);
	G_OBJECT_CLASS (gxml_gdocument_parent_class)->finalize (obj);
}


/**
 * Class implemeting {@link GXml.Document} interface, not tied to libxml-2.0 library.
 *
 * This class use {@link Xml.TextWriter} to write down XML documents using
 * its contained {@link GXml.Node} childs or other XML structures.
 */
GType gxml_gdocument_get_type (void) {
	static volatile gsize gxml_gdocument_type_id__volatile = 0;
	if (g_once_init_enter (&gxml_gdocument_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GXmlGDocumentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_gdocument_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlGDocument), 0, (GInstanceInitFunc) gxml_gdocument_instance_init, NULL };
		static const GInterfaceInfo gxml_document_info = { (GInterfaceInitFunc) gxml_gdocument_gxml_document_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gxml_gdocument_type_id;
		gxml_gdocument_type_id = g_type_register_static (GXML_TYPE_GNODE, "GXmlGDocument", &g_define_type_info, 0);
		g_type_add_interface_static (gxml_gdocument_type_id, GXML_TYPE_DOCUMENT, &gxml_document_info);
		g_once_init_leave (&gxml_gdocument_type_id__volatile, gxml_gdocument_type_id);
	}
	return gxml_gdocument_type_id__volatile;
}


static void _vala_gxml_gdocument_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GXmlGDocument * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_GDOCUMENT, GXmlGDocument);
	switch (property_id) {
		case GXML_GDOCUMENT_ATTRS:
		g_value_take_object (value, gxml_gnode_get_attrs ((GXmlGNode*) self));
		break;
		case GXML_GDOCUMENT_CHILDREN:
		g_value_take_object (value, gxml_gnode_get_children ((GXmlGNode*) self));
		break;
		case GXML_GDOCUMENT_NAMESPACES:
		g_value_take_object (value, gxml_gnode_get_namespaces ((GXmlGNode*) self));
		break;
		case GXML_GDOCUMENT_DOCUMENT:
		g_value_set_object (value, gxml_gnode_get_document ((GXmlGNode*) self));
		break;
		case GXML_GDOCUMENT_INDENT:
		g_value_set_boolean (value, gxml_document_get_indent ((GXmlDocument*) self));
		break;
		case GXML_GDOCUMENT_NS_TOP:
		g_value_set_boolean (value, gxml_document_get_ns_top ((GXmlDocument*) self));
		break;
		case GXML_GDOCUMENT_PREFIX_DEFAULT_NS:
		g_value_set_boolean (value, gxml_document_get_prefix_default_ns ((GXmlDocument*) self));
		break;
		case GXML_GDOCUMENT_BACKUP:
		g_value_set_boolean (value, gxml_document_get_backup ((GXmlDocument*) self));
		break;
		case GXML_GDOCUMENT_FILE:
		g_value_set_object (value, gxml_document_get_file ((GXmlDocument*) self));
		break;
		case GXML_GDOCUMENT_ROOT:
		g_value_take_object (value, gxml_document_get_root ((GXmlDocument*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gxml_gdocument_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GXmlGDocument * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_GDOCUMENT, GXmlGDocument);
	switch (property_id) {
		case GXML_GDOCUMENT_INDENT:
		gxml_document_set_indent ((GXmlDocument*) self, g_value_get_boolean (value));
		break;
		case GXML_GDOCUMENT_NS_TOP:
		gxml_document_set_ns_top ((GXmlDocument*) self, g_value_get_boolean (value));
		break;
		case GXML_GDOCUMENT_PREFIX_DEFAULT_NS:
		gxml_document_set_prefix_default_ns ((GXmlDocument*) self, g_value_get_boolean (value));
		break;
		case GXML_GDOCUMENT_BACKUP:
		gxml_document_set_backup ((GXmlDocument*) self, g_value_get_boolean (value));
		break;
		case GXML_GDOCUMENT_FILE:
		gxml_document_set_file ((GXmlDocument*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



