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

/* GAttribute.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>


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

#define GXML_TYPE_ATTRIBUTE (gxml_attribute_get_type ())
#define GXML_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_ATTRIBUTE, GXmlAttribute))
#define GXML_IS_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_ATTRIBUTE))
#define GXML_ATTRIBUTE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GXML_TYPE_ATTRIBUTE, GXmlAttributeIface))

typedef struct _GXmlAttribute GXmlAttribute;
typedef struct _GXmlAttributeIface GXmlAttributeIface;

#define GXML_TYPE_GATTRIBUTE (gxml_gattribute_get_type ())
#define GXML_GATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GATTRIBUTE, GXmlGAttribute))
#define GXML_GATTRIBUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GATTRIBUTE, GXmlGAttributeClass))
#define GXML_IS_GATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GATTRIBUTE))
#define GXML_IS_GATTRIBUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GATTRIBUTE))
#define GXML_GATTRIBUTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GATTRIBUTE, GXmlGAttributeClass))

typedef struct _GXmlGAttribute GXmlGAttribute;
typedef struct _GXmlGAttributeClass GXmlGAttributeClass;
typedef struct _GXmlGAttributePrivate GXmlGAttributePrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define GXML_TYPE_GNAMESPACE (gxml_gnamespace_get_type ())
#define GXML_GNAMESPACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_GNAMESPACE, GXmlGNamespace))
#define GXML_GNAMESPACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_GNAMESPACE, GXmlGNamespaceClass))
#define GXML_IS_GNAMESPACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_GNAMESPACE))
#define GXML_IS_GNAMESPACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_GNAMESPACE))
#define GXML_GNAMESPACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_GNAMESPACE, GXmlGNamespaceClass))

typedef struct _GXmlGNamespace GXmlGNamespace;
typedef struct _GXmlGNamespaceClass GXmlGNamespaceClass;

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 _GXmlAttributeIface {
	GTypeInterface parent_iface;
	GXmlNamespace* (*get_namespace) (GXmlAttribute* self);
	void (*set_namespace) (GXmlAttribute* self, GXmlNamespace* value);
	gchar* (*get_prefix) (GXmlAttribute* self);
};

struct _GXmlGAttribute {
	GXmlGNode parent_instance;
	GXmlGAttributePrivate * priv;
};

struct _GXmlGAttributeClass {
	GXmlGNodeClass parent_class;
};

struct _GXmlGAttributePrivate {
	xmlAttr* _attr;
};


static gpointer gxml_gattribute_parent_class = NULL;
static GXmlAttributeIface* gxml_gattribute_gxml_attribute_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;
GType gxml_attribute_get_type (void) G_GNUC_CONST;
GType gxml_gattribute_get_type (void) G_GNUC_CONST;
#define GXML_GATTRIBUTE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GXML_TYPE_GATTRIBUTE, GXmlGAttributePrivate))
enum  {
	GXML_GATTRIBUTE_DUMMY_PROPERTY,
	GXML_GATTRIBUTE_NAMESPACES,
	GXML_GATTRIBUTE_NAMESPACE,
	GXML_GATTRIBUTE_NAME,
	GXML_GATTRIBUTE_VALUE,
	GXML_GATTRIBUTE_PREFIX,
	GXML_GATTRIBUTE_PARENT
};
GXmlGAttribute* gxml_gattribute_new (GXmlGDocument* doc, xmlAttr* node);
GXmlGAttribute* gxml_gattribute_construct (GType object_type, GXmlGDocument* doc, xmlAttr* node);
GXmlGNode* gxml_gnode_construct (GType object_type);
GXmlGNamespace* gxml_gnamespace_new (xmlNs* ns);
GXmlGNamespace* gxml_gnamespace_construct (GType object_type, xmlNs* ns);
GType gxml_gnamespace_get_type (void) G_GNUC_CONST;
GXmlNode* gxml_gnode_to_gnode (GXmlGDocument* doc, xmlNode* node);
GXmlDocument* gxml_gnode_get_document (GXmlGNode* self);
static void gxml_gattribute_finalize (GObject* obj);
GeeList* gxml_gnode_get_namespaces (GXmlGNode* self);
GXmlNamespace* gxml_attribute_get_namespace (GXmlAttribute* self);
gchar* gxml_gnode_get_name (GXmlGNode* self);
gchar* gxml_gnode_get_value (GXmlGNode* self);
gchar* gxml_attribute_get_prefix (GXmlAttribute* self);
GXmlNode* gxml_gnode_get_parent (GXmlGNode* self);
static void _vala_gxml_gattribute_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
void gxml_attribute_set_namespace (GXmlAttribute* self, GXmlNamespace* value);
void gxml_gnode_set_value (GXmlGNode* self, const gchar* value);
static void _vala_gxml_gattribute_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


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


GXmlGAttribute* gxml_gattribute_construct (GType object_type, GXmlGDocument* doc, xmlAttr* node) {
	GXmlGAttribute * self = NULL;
	xmlAttr* _tmp0_ = NULL;
	xmlAttr* _tmp1_ = NULL;
	xmlNode* _tmp2_ = NULL;
	GXmlGDocument* _tmp3_ = NULL;
	GXmlGDocument* _tmp4_ = NULL;
	g_return_val_if_fail (doc != NULL, NULL);
	self = (GXmlGAttribute*) gxml_gnode_construct (object_type);
	_tmp0_ = node;
	self->priv->_attr = _tmp0_;
	_tmp1_ = self->priv->_attr;
	_tmp2_ = _tmp1_->parent;
	((GXmlGNode*) self)->_node = _tmp2_;
	_tmp3_ = doc;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (((GXmlGNode*) self)->_doc);
	((GXmlGNode*) self)->_doc = _tmp4_;
	return self;
}


GXmlGAttribute* gxml_gattribute_new (GXmlGDocument* doc, xmlAttr* node) {
	return gxml_gattribute_construct (GXML_TYPE_GATTRIBUTE, doc, node);
}


static GeeList* gxml_gattribute_real_get_namespaces (GXmlGNode* base) {
	GeeList* result;
	GXmlGAttribute* self;
	GeeArrayList* l = NULL;
	GeeArrayList* _tmp0_ = NULL;
	xmlAttr* _tmp1_ = NULL;
	xmlNs* _tmp2_ = NULL;
	GeeArrayList* _tmp3_ = NULL;
	xmlAttr* _tmp4_ = NULL;
	xmlNs* _tmp5_ = NULL;
	GXmlGNamespace* _tmp6_ = NULL;
	GXmlGNamespace* _tmp7_ = NULL;
	self = (GXmlGAttribute*) base;
	_tmp0_ = gee_array_list_new (GXML_TYPE_NAMESPACE, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL);
	l = _tmp0_;
	_tmp1_ = self->priv->_attr;
	_tmp2_ = _tmp1_->ns;
	if (_tmp2_ == NULL) {
		result = (GeeList*) l;
		return result;
	}
	_tmp3_ = l;
	_tmp4_ = self->priv->_attr;
	_tmp5_ = _tmp4_->ns;
	_tmp6_ = gxml_gnamespace_new (_tmp5_);
	_tmp7_ = _tmp6_;
	gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, (GXmlNamespace*) _tmp7_);
	_g_object_unref0 (_tmp7_);
	result = (GeeList*) l;
	return result;
}


static GXmlNamespace* gxml_gattribute_real_get_namespace (GXmlAttribute* base) {
	GXmlNamespace* result;
	GXmlGAttribute* self;
	xmlAttr* _tmp0_ = NULL;
	xmlAttr* _tmp1_ = NULL;
	xmlNs* _tmp2_ = NULL;
	xmlAttr* _tmp3_ = NULL;
	xmlNs* _tmp4_ = NULL;
	GXmlGNamespace* _tmp5_ = NULL;
	self = (GXmlGAttribute*) base;
	_tmp0_ = self->priv->_attr;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->priv->_attr;
	_tmp2_ = _tmp1_->ns;
	if (_tmp2_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp3_ = self->priv->_attr;
	_tmp4_ = _tmp3_->ns;
	_tmp5_ = gxml_gnamespace_new (_tmp4_);
	result = (GXmlNamespace*) _tmp5_;
	return result;
}


static void gxml_gattribute_real_set_namespace (GXmlAttribute* base, GXmlNamespace* value) {
	GXmlGAttribute* self;
	self = (GXmlGAttribute*) base;
	g_object_notify ((GObject *) self, "namespace");
}


static gchar* gxml_gattribute_real_get_name (GXmlGNode* base) {
	gchar* result;
	GXmlGAttribute* self;
	xmlAttr* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	self = (GXmlGAttribute*) base;
	_tmp0_ = self->priv->_attr;
	_tmp1_ = _tmp0_->name;
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}


static gchar* gxml_gattribute_real_get_value (GXmlGNode* base) {
	gchar* result;
	GXmlGAttribute* self;
	xmlNode* _tmp0_ = NULL;
	xmlAttr* _tmp1_ = NULL;
	xmlNs* _tmp2_ = NULL;
	self = (GXmlGAttribute*) base;
	_tmp0_ = ((GXmlGNode*) self)->_node;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->priv->_attr;
	_tmp2_ = _tmp1_->ns;
	if (_tmp2_ == NULL) {
		xmlNode* _tmp3_ = NULL;
		xmlAttr* _tmp4_ = NULL;
		const gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		_tmp3_ = ((GXmlGNode*) self)->_node;
		_tmp4_ = self->priv->_attr;
		_tmp5_ = _tmp4_->name;
		_tmp6_ = (gchar*) xmlGetNoNsProp (_tmp3_, (xmlChar*) _tmp5_);
		result = _tmp6_;
		return result;
	} else {
		xmlNode* _tmp7_ = NULL;
		xmlAttr* _tmp8_ = NULL;
		const gchar* _tmp9_ = NULL;
		xmlAttr* _tmp10_ = NULL;
		xmlNs* _tmp11_ = NULL;
		const gchar* _tmp12_ = NULL;
		gchar* _tmp13_ = NULL;
		_tmp7_ = ((GXmlGNode*) self)->_node;
		_tmp8_ = self->priv->_attr;
		_tmp9_ = _tmp8_->name;
		_tmp10_ = self->priv->_attr;
		_tmp11_ = _tmp10_->ns;
		_tmp12_ = _tmp11_->href;
		_tmp13_ = (gchar*) xmlGetNsProp (_tmp7_, (xmlChar*) _tmp9_, (xmlChar*) _tmp12_);
		result = _tmp13_;
		return result;
	}
}


static void gxml_gattribute_real_set_value (GXmlGNode* base, const gchar* value) {
	GXmlGAttribute* self;
	xmlNode* _tmp0_ = NULL;
	xmlAttr* _tmp1_ = NULL;
	xmlNs* _tmp2_ = NULL;
	self = (GXmlGAttribute*) base;
	_tmp0_ = ((GXmlGNode*) self)->_node;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->_attr;
	_tmp2_ = _tmp1_->ns;
	if (_tmp2_ == NULL) {
		xmlNode* _tmp3_ = NULL;
		xmlAttr* _tmp4_ = NULL;
		const gchar* _tmp5_ = NULL;
		const gchar* _tmp6_ = NULL;
		_tmp3_ = ((GXmlGNode*) self)->_node;
		_tmp4_ = self->priv->_attr;
		_tmp5_ = _tmp4_->name;
		_tmp6_ = value;
		xmlSetProp (_tmp3_, (xmlChar*) _tmp5_, (xmlChar*) _tmp6_);
	} else {
		xmlNode* _tmp7_ = NULL;
		xmlAttr* _tmp8_ = NULL;
		xmlNs* _tmp9_ = NULL;
		xmlAttr* _tmp10_ = NULL;
		const gchar* _tmp11_ = NULL;
		const gchar* _tmp12_ = NULL;
		_tmp7_ = ((GXmlGNode*) self)->_node;
		_tmp8_ = self->priv->_attr;
		_tmp9_ = _tmp8_->ns;
		_tmp10_ = self->priv->_attr;
		_tmp11_ = _tmp10_->name;
		_tmp12_ = value;
		xmlSetNsProp (_tmp7_, _tmp9_, (xmlChar*) _tmp11_, (xmlChar*) _tmp12_);
	}
	g_object_notify ((GObject *) self, "value");
}


static gchar* gxml_gattribute_real_get_prefix (GXmlAttribute* base) {
	gchar* result;
	GXmlGAttribute* self;
	xmlAttr* _tmp0_ = NULL;
	xmlAttr* _tmp2_ = NULL;
	xmlNs* _tmp3_ = NULL;
	xmlAttr* _tmp5_ = NULL;
	xmlNs* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	gchar* _tmp8_ = NULL;
	self = (GXmlGAttribute*) base;
	_tmp0_ = self->priv->_attr;
	if (_tmp0_ == NULL) {
		gchar* _tmp1_ = NULL;
		_tmp1_ = g_strdup ("");
		result = _tmp1_;
		return result;
	}
	_tmp2_ = self->priv->_attr;
	_tmp3_ = _tmp2_->ns;
	if (_tmp3_ == NULL) {
		gchar* _tmp4_ = NULL;
		_tmp4_ = g_strdup ("");
		result = _tmp4_;
		return result;
	}
	_tmp5_ = self->priv->_attr;
	_tmp6_ = _tmp5_->ns;
	_tmp7_ = _tmp6_->prefix;
	_tmp8_ = g_strdup (_tmp7_);
	result = _tmp8_;
	return result;
}


static GXmlNode* gxml_gattribute_real_get_parent (GXmlGNode* base) {
	GXmlNode* result;
	GXmlGAttribute* self;
	xmlAttr* _tmp0_ = NULL;
	GXmlDocument* _tmp1_ = NULL;
	GXmlDocument* _tmp2_ = NULL;
	xmlNode* _tmp3_ = NULL;
	GXmlNode* _tmp4_ = NULL;
	self = (GXmlGAttribute*) base;
	_tmp0_ = self->priv->_attr;
	if (_tmp0_ == NULL) {
		result = NULL;
		return result;
	}
	_tmp1_ = gxml_gnode_get_document ((GXmlGNode*) self);
	_tmp2_ = _tmp1_;
	_tmp3_ = ((GXmlGNode*) self)->_node;
	_tmp4_ = gxml_gnode_to_gnode (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, GXML_TYPE_GDOCUMENT) ? ((GXmlGDocument*) _tmp2_) : NULL, _tmp3_);
	result = _tmp4_;
	return result;
}


static void gxml_gattribute_class_init (GXmlGAttributeClass * klass) {
	gxml_gattribute_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GXmlGAttributePrivate));
	GXML_GNODE_CLASS (klass)->get_namespaces = gxml_gattribute_real_get_namespaces;
	GXML_GNODE_CLASS (klass)->get_name = gxml_gattribute_real_get_name;
	GXML_GNODE_CLASS (klass)->get_value = gxml_gattribute_real_get_value;
	GXML_GNODE_CLASS (klass)->set_value = gxml_gattribute_real_set_value;
	GXML_GNODE_CLASS (klass)->get_parent = gxml_gattribute_real_get_parent;
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_gattribute_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gxml_gattribute_set_property;
	G_OBJECT_CLASS (klass)->finalize = gxml_gattribute_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_GATTRIBUTE_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_GATTRIBUTE_NAMESPACE, g_param_spec_object ("namespace", "namespace", "namespace", GXML_TYPE_NAMESPACE, 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_GATTRIBUTE_NAME, g_param_spec_string ("name", "name", "name", NULL, 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_GATTRIBUTE_VALUE, g_param_spec_string ("value", "value", "value", NULL, 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_GATTRIBUTE_PREFIX, g_param_spec_string ("prefix", "prefix", "prefix", NULL, 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_GATTRIBUTE_PARENT, g_param_spec_object ("parent", "parent", "parent", GXML_TYPE_NODE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}


static void gxml_gattribute_gxml_attribute_interface_init (GXmlAttributeIface * iface) {
	gxml_gattribute_gxml_attribute_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_namespace = gxml_gattribute_real_get_namespace;
	iface->set_namespace = gxml_gattribute_real_set_namespace;
	iface->get_prefix = gxml_gattribute_real_get_prefix;
}


static void gxml_gattribute_instance_init (GXmlGAttribute * self) {
	self->priv = GXML_GATTRIBUTE_GET_PRIVATE (self);
}


static void gxml_gattribute_finalize (GObject* obj) {
	GXmlGAttribute * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_GATTRIBUTE, GXmlGAttribute);
	G_OBJECT_CLASS (gxml_gattribute_parent_class)->finalize (obj);
}


/**
 * Class implemeting {@link GXml.Attribute} interface, not tied to libxml-2.0 library.
 */
GType gxml_gattribute_get_type (void) {
	static volatile gsize gxml_gattribute_type_id__volatile = 0;
	if (g_once_init_enter (&gxml_gattribute_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GXmlGAttributeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_gattribute_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlGAttribute), 0, (GInstanceInitFunc) gxml_gattribute_instance_init, NULL };
		static const GInterfaceInfo gxml_attribute_info = { (GInterfaceInitFunc) gxml_gattribute_gxml_attribute_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gxml_gattribute_type_id;
		gxml_gattribute_type_id = g_type_register_static (GXML_TYPE_GNODE, "GXmlGAttribute", &g_define_type_info, 0);
		g_type_add_interface_static (gxml_gattribute_type_id, GXML_TYPE_ATTRIBUTE, &gxml_attribute_info);
		g_once_init_leave (&gxml_gattribute_type_id__volatile, gxml_gattribute_type_id);
	}
	return gxml_gattribute_type_id__volatile;
}


static void _vala_gxml_gattribute_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	GXmlGAttribute * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_GATTRIBUTE, GXmlGAttribute);
	switch (property_id) {
		case GXML_GATTRIBUTE_NAMESPACES:
		g_value_take_object (value, gxml_gnode_get_namespaces ((GXmlGNode*) self));
		break;
		case GXML_GATTRIBUTE_NAMESPACE:
		g_value_take_object (value, gxml_attribute_get_namespace ((GXmlAttribute*) self));
		break;
		case GXML_GATTRIBUTE_NAME:
		g_value_take_string (value, gxml_gnode_get_name ((GXmlGNode*) self));
		break;
		case GXML_GATTRIBUTE_VALUE:
		g_value_take_string (value, gxml_gnode_get_value ((GXmlGNode*) self));
		break;
		case GXML_GATTRIBUTE_PREFIX:
		g_value_take_string (value, gxml_attribute_get_prefix ((GXmlAttribute*) self));
		break;
		case GXML_GATTRIBUTE_PARENT:
		g_value_take_object (value, gxml_gnode_get_parent ((GXmlGNode*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_gxml_gattribute_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	GXmlGAttribute * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_GATTRIBUTE, GXmlGAttribute);
	switch (property_id) {
		case GXML_GATTRIBUTE_NAMESPACE:
		gxml_attribute_set_namespace ((GXmlAttribute*) self, g_value_get_object (value));
		break;
		case GXML_GATTRIBUTE_VALUE:
		gxml_gnode_set_value ((GXmlGNode*) self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



