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

/* TElement.vala
 *
 * Copyright (C) 2015  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-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gee.h>
#include <gio/gio.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;
typedef enum  {
	GXML_NODE_TYPE_INVALID = 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;

#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_TNODE (gxml_tnode_get_type ())
#define GXML_TNODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_TNODE, GXmlTNode))
#define GXML_TNODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_TNODE, GXmlTNodeClass))
#define GXML_IS_TNODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_TNODE))
#define GXML_IS_TNODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_TNODE))
#define GXML_TNODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_TNODE, GXmlTNodeClass))

typedef struct _GXmlTNode GXmlTNode;
typedef struct _GXmlTNodeClass GXmlTNodeClass;
typedef struct _GXmlTNodePrivate GXmlTNodePrivate;

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

#define GXML_TYPE_TELEMENT (gxml_telement_get_type ())
#define GXML_TELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_TELEMENT, GXmlTElement))
#define GXML_TELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_TELEMENT, GXmlTElementClass))
#define GXML_IS_TELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_TELEMENT))
#define GXML_IS_TELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_TELEMENT))
#define GXML_TELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_TELEMENT, GXmlTElementClass))

typedef struct _GXmlTElement GXmlTElement;
typedef struct _GXmlTElementClass GXmlTElementClass;
typedef struct _GXmlTElementPrivate GXmlTElementPrivate;

#define GXML_TNODE_TYPE_TCHILDREN_LIST (gxml_tnode_tchildren_list_get_type ())
#define GXML_TNODE_TCHILDREN_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TNODE_TYPE_TCHILDREN_LIST, GXmlTNodeTChildrenList))
#define GXML_TNODE_TCHILDREN_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TNODE_TYPE_TCHILDREN_LIST, GXmlTNodeTChildrenListClass))
#define GXML_TNODE_IS_TCHILDREN_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TNODE_TYPE_TCHILDREN_LIST))
#define GXML_TNODE_IS_TCHILDREN_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TNODE_TYPE_TCHILDREN_LIST))
#define GXML_TNODE_TCHILDREN_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TNODE_TYPE_TCHILDREN_LIST, GXmlTNodeTChildrenListClass))

typedef struct _GXmlTNodeTChildrenList GXmlTNodeTChildrenList;
typedef struct _GXmlTNodeTChildrenListClass GXmlTNodeTChildrenListClass;
enum  {
	GXML_TELEMENT_0_PROPERTY,
	GXML_TELEMENT_VALUE_PROPERTY,
	GXML_TELEMENT_ATTRS_PROPERTY,
	GXML_TELEMENT_CHILDREN_NODES_PROPERTY,
	GXML_TELEMENT_NAMESPACES_PROPERTY,
	GXML_TELEMENT_CONTENT_PROPERTY,
	GXML_TELEMENT_TAG_NAME_PROPERTY,
	GXML_TELEMENT_NUM_PROPERTIES
};
static GParamSpec* gxml_telement_properties[GXML_TELEMENT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define GXML_TYPE_TDOCUMENT (gxml_tdocument_get_type ())
#define GXML_TDOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_TDOCUMENT, GXmlTDocument))
#define GXML_TDOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_TDOCUMENT, GXmlTDocumentClass))
#define GXML_IS_TDOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_TDOCUMENT))
#define GXML_IS_TDOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_TDOCUMENT))
#define GXML_TDOCUMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_TDOCUMENT, GXmlTDocumentClass))

typedef struct _GXmlTDocument GXmlTDocument;
typedef struct _GXmlTDocumentClass GXmlTDocumentClass;

#define GXML_TYPE_TATTRIBUTE (gxml_tattribute_get_type ())
#define GXML_TATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_TATTRIBUTE, GXmlTAttribute))
#define GXML_TATTRIBUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GXML_TYPE_TATTRIBUTE, GXmlTAttributeClass))
#define GXML_IS_TATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_TATTRIBUTE))
#define GXML_IS_TATTRIBUTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GXML_TYPE_TATTRIBUTE))
#define GXML_TATTRIBUTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GXML_TYPE_TATTRIBUTE, GXmlTAttributeClass))

typedef struct _GXmlTAttribute GXmlTAttribute;
typedef struct _GXmlTAttributeClass GXmlTAttributeClass;

#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_TEXT (gxml_text_get_type ())
#define GXML_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GXML_TYPE_TEXT, GXmlText))
#define GXML_IS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GXML_TYPE_TEXT))
#define GXML_TEXT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GXML_TYPE_TEXT, GXmlTextIface))

typedef struct _GXmlText GXmlText;
typedef struct _GXmlTextIface GXmlTextIface;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

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

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);
	GXmlElementList* (*get_elements_by_name) (GXmlNode* self, const gchar* name);
	GXmlElementList* (*get_elements_by_name_ns) (GXmlNode* self, const gchar* name, const gchar* ns);
	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_children_nodes) (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 _GXmlTNode {
	GObject parent_instance;
	GXmlTNodePrivate * priv;
	gchar* _name;
	gchar* _value;
	GXmlDocument* _doc;
	GXmlNode* _parent;
	GXmlNodeType _node_type;
	xmlTextWriter* tw;
};

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

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 (*remove_ns_attr) (GXmlElement* self, const gchar* name, const gchar* uri);
	void (*set_ns_attr) (GXmlElement* self, const gchar* 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);
};

struct _GXmlTElement {
	GXmlTNode parent_instance;
	GXmlTElementPrivate * priv;
	GeeHashMap* _attrs;
	GXmlTNodeTChildrenList* _children;
	GeeArrayList* _namespaces;
};

struct _GXmlTElementClass {
	GXmlTNodeClass parent_class;
};

struct _GXmlTElementPrivate {
	gchar* _content;
};

struct _GXmlAttributeIface {
	GTypeInterface parent_iface;
	GXmlNamespace* (*get_namespace) (GXmlAttribute* self);
	void (*set_namespace) (GXmlAttribute* self, GXmlNamespace* value);
	gchar* (*get_prefix) (GXmlAttribute* self);
};

struct _GXmlTextIface {
	GTypeInterface parent_iface;
	gchar* (*get_str) (GXmlText* self);
	void (*set_str) (GXmlText* self, const gchar* value);
};

static gint GXmlTElement_private_offset;
static gpointer gxml_telement_parent_class = NULL;
static GXmlElementIface * gxml_telement_gxml_element_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_tnode_get_type (void) G_GNUC_CONST;
GType gxml_element_get_type (void) G_GNUC_CONST;
GType gxml_telement_get_type (void) G_GNUC_CONST;
GType gxml_tnode_tchildren_list_get_type (void) G_GNUC_CONST;
GXmlTElement* gxml_telement_new (GXmlDocument* d,
                                 const gchar* name);
GXmlTElement* gxml_telement_construct (GType object_type,
                                       GXmlDocument* d,
                                       const gchar* name);
GType gxml_tdocument_get_type (void) G_GNUC_CONST;
GXmlTNode* gxml_tnode_construct (GType object_type);
static void gxml_telement_real_set_attr (GXmlElement* base,
                                  const gchar* name,
                                  const gchar* value);
GType gxml_tattribute_get_type (void) G_GNUC_CONST;
GXmlDocument* gxml_tnode_get_document (GXmlTNode* self);
GXmlTAttribute* gxml_tattribute_new (GXmlDocument* d,
                                     const gchar* name,
                                     const gchar* value);
GXmlTAttribute* gxml_tattribute_construct (GType object_type,
                                           GXmlDocument* d,
                                           const gchar* name,
                                           const gchar* value);
void gxml_tnode_set_parent (GXmlTNode* self,
                            GXmlNode* node);
GeeMap* gxml_tnode_get_attrs (GXmlTNode* self);
static GXmlNode* gxml_telement_real_get_attr (GXmlElement* base,
                                       const gchar* name);
static GXmlNode* gxml_telement_real_get_ns_attr (GXmlElement* base,
                                          const gchar* name,
                                          const gchar* uri);
gchar* gxml_node_get_name (GXmlNode* self);
GType gxml_attribute_get_type (void) G_GNUC_CONST;
GXmlNamespace* gxml_attribute_get_namespace (GXmlAttribute* self);
gchar* gxml_namespace_get_uri (GXmlNamespace* self);
static void gxml_telement_real_set_ns_attr (GXmlElement* base,
                                     const gchar* ns,
                                     const gchar* name,
                                     const gchar* value);
gboolean gxml_tnode_set_namespace (GXmlTNode* self,
                                   const gchar* uri,
                                   const gchar* prefix);
static void gxml_telement_real_remove_attr (GXmlElement* base,
                                     const gchar* name);
static void gxml_telement_real_remove_ns_attr (GXmlElement* base,
                                        const gchar* name,
                                        const gchar* uri);
static void gxml_telement_real_normalize (GXmlElement* base);
static void gxml_telement_calculate_content (GXmlTElement* self);
GeeBidirList* gxml_tnode_get_children_nodes (GXmlTNode* self);
GType gxml_text_get_type (void) G_GNUC_CONST;
gchar* gxml_node_get_value (GXmlNode* self);
static void gxml_telement_update_content (GXmlTElement* self,
                                   const gchar* val);
GXmlNode* gxml_document_create_text (GXmlDocument* self,
                                     const gchar* text);
GXmlTNodeTChildrenList* gxml_tnode_tchildren_list_new (GXmlNode* e);
GXmlTNodeTChildrenList* gxml_tnode_tchildren_list_construct (GType object_type,
                                                             GXmlNode* e);
gchar* gxml_tnode_get_name (GXmlTNode* self);
static GObject * gxml_telement_constructor (GType type,
                                     guint n_construct_properties,
                                     GObjectConstructParam * construct_properties);
static void gxml_telement_finalize (GObject * obj);
gchar* gxml_tnode_get_value (GXmlTNode* self);
GeeList* gxml_tnode_get_namespaces (GXmlTNode* self);
gchar* gxml_element_get_content (GXmlElement* self);
gchar* gxml_element_get_tag_name (GXmlElement* self);
static void _vala_gxml_telement_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec);
void gxml_tnode_set_value (GXmlTNode* self,
                           const gchar* value);
void gxml_element_set_content (GXmlElement* self,
                               const gchar* value);
static void _vala_gxml_telement_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gint array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gint array_length,
                       GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);

static inline gpointer
gxml_telement_get_instance_private (GXmlTElement* self)
{
	return G_STRUCT_MEMBER_P (self, GXmlTElement_private_offset);
}

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

GXmlTElement*
gxml_telement_construct (GType object_type,
                         GXmlDocument* d,
                         const gchar* name)
{
	GXmlTElement * self = NULL;
	GXmlDocument* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (d != NULL, NULL);
	g_return_val_if_fail (name != NULL, NULL);
	_vala_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (d, GXML_TYPE_TDOCUMENT), "d is TDocument", NULL);
	self = (GXmlTElement*) gxml_tnode_construct (object_type);
	_tmp0_ = _g_object_ref0 (d);
	_g_object_unref0 (((GXmlTNode*) self)->_doc);
	((GXmlTNode*) self)->_doc = _tmp0_;
	_tmp1_ = g_strdup (name);
	_g_free0 (((GXmlTNode*) self)->_name);
	((GXmlTNode*) self)->_name = _tmp1_;
	return self;
}

GXmlTElement*
gxml_telement_new (GXmlDocument* d,
                   const gchar* name)
{
	return gxml_telement_construct (GXML_TYPE_TELEMENT, d, name);
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gboolean result = FALSE;
	gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static void
gxml_telement_real_set_attr (GXmlElement* base,
                             const gchar* name,
                             const gchar* value)
{
	GXmlTElement * self;
	GXmlTAttribute* att = NULL;
	GXmlDocument* _tmp0_;
	GXmlDocument* _tmp1_;
	GXmlTAttribute* _tmp2_;
	GXmlTAttribute* _tmp3_;
	GeeMap* _tmp4_;
	GeeMap* _tmp5_;
	GeeMap* _tmp6_;
	GXmlTAttribute* _tmp7_;
	self = (GXmlTElement*) base;
	g_return_if_fail (name != NULL);
	g_return_if_fail (value != NULL);
	if (string_contains (name, ":")) {
		return;
	}
	_tmp0_ = gxml_tnode_get_document ((GXmlTNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gxml_tattribute_new (_tmp1_, name, value);
	att = _tmp2_;
	_tmp3_ = att;
	gxml_tnode_set_parent ((GXmlTNode*) _tmp3_, (GXmlNode*) self);
	_tmp4_ = gxml_tnode_get_attrs ((GXmlTNode*) self);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp7_ = att;
	gee_map_set (_tmp6_, name, (GXmlNode*) _tmp7_);
	_g_object_unref0 (_tmp6_);
	_g_object_unref0 (att);
}

static GXmlNode*
gxml_telement_real_get_attr (GXmlElement* base,
                             const gchar* name)
{
	GXmlTElement * self;
	GXmlNode* result = NULL;
	GeeMap* _tmp0_;
	GeeMap* _tmp1_;
	GeeMap* _tmp2_;
	gpointer _tmp3_;
	GXmlNode* _tmp4_;
	self = (GXmlTElement*) base;
	g_return_val_if_fail (name != NULL, NULL);
	_tmp0_ = gxml_tnode_get_attrs ((GXmlTNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_get (_tmp2_, name);
	_tmp4_ = (GXmlNode*) _tmp3_;
	_g_object_unref0 (_tmp2_);
	result = _tmp4_;
	return result;
}

static GXmlNode*
gxml_telement_real_get_ns_attr (GXmlElement* base,
                                const gchar* name,
                                const gchar* uri)
{
	GXmlTElement * self;
	GXmlNode* result = NULL;
	self = (GXmlTElement*) base;
	g_return_val_if_fail (name != NULL, NULL);
	g_return_val_if_fail (uri != NULL, NULL);
	{
		GeeIterator* _k_it = NULL;
		GeeMap* _tmp0_;
		GeeMap* _tmp1_;
		GeeMap* _tmp2_;
		GeeSet* _tmp3_;
		GeeSet* _tmp4_;
		GeeSet* _tmp5_;
		GeeIterator* _tmp6_;
		GeeIterator* _tmp7_;
		_tmp0_ = gxml_tnode_get_attrs ((GXmlTNode*) self);
		_tmp1_ = _tmp0_;
		_tmp2_ = _tmp1_;
		_tmp3_ = gee_map_get_keys (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = _tmp4_;
		_tmp6_ = gee_iterable_iterator ((GeeIterable*) _tmp5_);
		_tmp7_ = _tmp6_;
		_g_object_unref0 (_tmp5_);
		_g_object_unref0 (_tmp2_);
		_k_it = _tmp7_;
		while (TRUE) {
			GeeIterator* _tmp8_;
			gchar* k = NULL;
			GeeIterator* _tmp9_;
			gpointer _tmp10_;
			const gchar* _tmp11_;
			GXmlNode* a = NULL;
			GeeMap* _tmp12_;
			GeeMap* _tmp13_;
			GeeMap* _tmp14_;
			const gchar* _tmp15_;
			gpointer _tmp16_;
			GXmlNode* _tmp17_;
			GXmlNode* _tmp18_;
			gchar* _tmp19_;
			gchar* _tmp20_;
			gchar* _tmp21_;
			gboolean _tmp22_;
			GXmlNode* _tmp23_;
			GXmlNamespace* _tmp24_;
			GXmlNamespace* _tmp25_;
			GXmlNamespace* _tmp26_;
			gboolean _tmp27_;
			GXmlNode* _tmp28_;
			GXmlNamespace* _tmp29_;
			GXmlNamespace* _tmp30_;
			GXmlNamespace* _tmp31_;
			gchar* _tmp32_;
			gchar* _tmp33_;
			gchar* _tmp34_;
			gboolean _tmp35_;
			_tmp8_ = _k_it;
			if (!gee_iterator_next (_tmp8_)) {
				break;
			}
			_tmp9_ = _k_it;
			_tmp10_ = gee_iterator_get (_tmp9_);
			k = (gchar*) _tmp10_;
			_tmp11_ = k;
			if (!string_contains (_tmp11_, ":")) {
				_g_free0 (k);
				continue;
			}
			_tmp12_ = gxml_tnode_get_attrs ((GXmlTNode*) self);
			_tmp13_ = _tmp12_;
			_tmp14_ = _tmp13_;
			_tmp15_ = k;
			_tmp16_ = gee_map_get (_tmp14_, _tmp15_);
			_tmp17_ = (GXmlNode*) _tmp16_;
			_g_object_unref0 (_tmp14_);
			a = _tmp17_;
			_tmp18_ = a;
			_tmp19_ = gxml_node_get_name (_tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = _tmp20_;
			_tmp22_ = g_strcmp0 (_tmp21_, name) != 0;
			_g_free0 (_tmp21_);
			if (_tmp22_) {
				_g_object_unref0 (a);
				_g_free0 (k);
				continue;
			}
			_tmp23_ = a;
			_tmp24_ = gxml_attribute_get_namespace (G_TYPE_CHECK_INSTANCE_CAST (_tmp23_, GXML_TYPE_ATTRIBUTE, GXmlAttribute));
			_tmp25_ = _tmp24_;
			_tmp26_ = _tmp25_;
			_tmp27_ = _tmp26_ == NULL;
			_g_object_unref0 (_tmp26_);
			if (_tmp27_) {
				_g_object_unref0 (a);
				_g_free0 (k);
				continue;
			}
			_tmp28_ = a;
			_tmp29_ = gxml_attribute_get_namespace (G_TYPE_CHECK_INSTANCE_CAST (_tmp28_, GXML_TYPE_ATTRIBUTE, GXmlAttribute));
			_tmp30_ = _tmp29_;
			_tmp31_ = _tmp30_;
			_tmp32_ = gxml_namespace_get_uri (_tmp31_);
			_tmp33_ = _tmp32_;
			_tmp34_ = _tmp33_;
			_tmp35_ = g_strcmp0 (_tmp34_, uri) == 0;
			_g_free0 (_tmp34_);
			_g_object_unref0 (_tmp31_);
			if (_tmp35_) {
				GXmlNode* _tmp36_;
				GXmlNode* _tmp37_;
				_tmp36_ = a;
				_tmp37_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp36_, GXML_TYPE_NODE, GXmlNode));
				result = _tmp37_;
				_g_object_unref0 (a);
				_g_free0 (k);
				_g_object_unref0 (_k_it);
				return result;
			}
			_g_object_unref0 (a);
			_g_free0 (k);
		}
		_g_object_unref0 (_k_it);
	}
	result = NULL;
	return result;
}

static void
gxml_telement_real_set_ns_attr (GXmlElement* base,
                                const gchar* ns,
                                const gchar* name,
                                const gchar* value)
{
	GXmlTElement * self;
	GXmlTAttribute* att = NULL;
	GXmlDocument* _tmp0_;
	GXmlDocument* _tmp1_;
	GXmlTAttribute* _tmp2_;
	gchar* prefix = NULL;
	gchar* uri = NULL;
	gchar* _tmp3_;
	GXmlTAttribute* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	GXmlTAttribute* _tmp21_;
	gchar* p = NULL;
	gchar* _tmp22_;
	const gchar* _tmp23_;
	GeeMap* _tmp26_;
	GeeMap* _tmp27_;
	GeeMap* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gchar* _tmp32_;
	gchar* _tmp33_;
	GXmlTAttribute* _tmp34_;
	self = (GXmlTElement*) base;
	g_return_if_fail (ns != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (value != NULL);
	_tmp0_ = gxml_tnode_get_document ((GXmlTNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = gxml_tattribute_new (_tmp1_, name, value);
	att = _tmp2_;
	prefix = NULL;
	_tmp3_ = g_strdup ("");
	uri = _tmp3_;
	if (string_contains (ns, ":")) {
		gchar** s = NULL;
		gchar** _tmp4_;
		gchar** _tmp5_;
		gint s_length1;
		gint _s_size_;
		gchar** _tmp6_;
		gint _tmp6__length1;
		const gchar* _tmp7_;
		gchar* _tmp8_;
		gchar** _tmp9_;
		gint _tmp9__length1;
		gchar** _tmp10_;
		gint _tmp10__length1;
		const gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		gchar** _tmp14_;
		gint _tmp14__length1;
		const gchar* _tmp15_;
		gchar* _tmp16_;
		_tmp5_ = _tmp4_ = g_strsplit (ns, ":", 0);
		s = _tmp5_;
		s_length1 = _vala_array_length (_tmp4_);
		_s_size_ = s_length1;
		_tmp6_ = s;
		_tmp6__length1 = s_length1;
		_tmp7_ = _tmp6_[0];
		_tmp8_ = g_strdup (_tmp7_);
		_g_free0 (prefix);
		prefix = _tmp8_;
		_tmp9_ = s;
		_tmp9__length1 = s_length1;
		if (_tmp9__length1 != 3) {
			s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
			_g_free0 (uri);
			_g_free0 (prefix);
			_g_object_unref0 (att);
			return;
		}
		_tmp10_ = s;
		_tmp10__length1 = s_length1;
		_tmp11_ = _tmp10_[1];
		_tmp12_ = g_strconcat (_tmp11_, ":", NULL);
		_tmp13_ = _tmp12_;
		_tmp14_ = s;
		_tmp14__length1 = s_length1;
		_tmp15_ = _tmp14_[2];
		_tmp16_ = g_strconcat (_tmp13_, _tmp15_, NULL);
		_g_free0 (uri);
		uri = _tmp16_;
		_g_free0 (_tmp13_);
		s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
	} else {
		gchar* _tmp17_;
		_tmp17_ = g_strdup (ns);
		_g_free0 (uri);
		uri = _tmp17_;
	}
	_tmp18_ = att;
	_tmp19_ = uri;
	_tmp20_ = prefix;
	gxml_tnode_set_namespace ((GXmlTNode*) _tmp18_, _tmp19_, _tmp20_);
	_tmp21_ = att;
	gxml_tnode_set_parent ((GXmlTNode*) _tmp21_, (GXmlNode*) self);
	_tmp22_ = g_strdup ("");
	p = _tmp22_;
	_tmp23_ = prefix;
	if (_tmp23_ != NULL) {
		const gchar* _tmp24_;
		gchar* _tmp25_;
		_tmp24_ = prefix;
		_tmp25_ = g_strdup (_tmp24_);
		_g_free0 (p);
		p = _tmp25_;
	}
	_tmp26_ = gxml_tnode_get_attrs ((GXmlTNode*) self);
	_tmp27_ = _tmp26_;
	_tmp28_ = _tmp27_;
	_tmp29_ = p;
	_tmp30_ = g_strconcat (_tmp29_, ":", NULL);
	_tmp31_ = _tmp30_;
	_tmp32_ = g_strconcat (_tmp31_, name, NULL);
	_tmp33_ = _tmp32_;
	_tmp34_ = att;
	gee_map_set (_tmp28_, _tmp33_, (GXmlNode*) _tmp34_);
	_g_free0 (_tmp33_);
	_g_free0 (_tmp31_);
	_g_object_unref0 (_tmp28_);
	_g_free0 (p);
	_g_free0 (uri);
	_g_free0 (prefix);
	_g_object_unref0 (att);
}

static void
gxml_telement_real_remove_attr (GXmlElement* base,
                                const gchar* name)
{
	GXmlTElement * self;
	GeeMap* _tmp0_;
	GeeMap* _tmp1_;
	GeeMap* _tmp2_;
	gboolean _tmp3_;
	self = (GXmlTElement*) base;
	g_return_if_fail (name != NULL);
	_tmp0_ = gxml_tnode_get_attrs ((GXmlTNode*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gee_map_has_key (_tmp2_, name);
	_g_object_unref0 (_tmp2_);
	if (_tmp3_) {
		GeeMap* _tmp4_;
		GeeMap* _tmp5_;
		GeeMap* _tmp6_;
		_tmp4_ = gxml_tnode_get_attrs ((GXmlTNode*) self);
		_tmp5_ = _tmp4_;
		_tmp6_ = _tmp5_;
		gee_map_unset (_tmp6_, name, NULL);
		_g_object_unref0 (_tmp6_);
	}
}

static void
gxml_telement_real_remove_ns_attr (GXmlElement* base,
                                   const gchar* name,
                                   const gchar* uri)
{
	GXmlTElement * self;
	gchar* prefix = NULL;
	gchar* _tmp0_;
	gchar* nuri = NULL;
	gchar* _tmp1_;
	self = (GXmlTElement*) base;
	g_return_if_fail (name != NULL);
	g_return_if_fail (uri != NULL);
	_tmp0_ = g_strdup ("");
	prefix = _tmp0_;
	_tmp1_ = g_strdup ("");
	nuri = _tmp1_;
	if (string_contains (uri, ":")) {
		gchar** s = NULL;
		gchar** _tmp2_;
		gchar** _tmp3_;
		gint s_length1;
		gint _s_size_;
		gchar** _tmp4_;
		gint _tmp4__length1;
		const gchar* _tmp5_;
		gchar* _tmp6_;
		gchar* _tmp7_;
		_tmp3_ = _tmp2_ = g_strsplit (uri, ":", 0);
		s = _tmp3_;
		s_length1 = _vala_array_length (_tmp2_);
		_s_size_ = s_length1;
		_tmp4_ = s;
		_tmp4__length1 = s_length1;
		_tmp5_ = _tmp4_[0];
		_tmp6_ = g_strdup (_tmp5_);
		_g_free0 (prefix);
		prefix = _tmp6_;
		_tmp7_ = g_strdup (uri);
		_g_free0 (nuri);
		nuri = _tmp7_;
		s = (_vala_array_free (s, s_length1, (GDestroyNotify) g_free), NULL);
	} else {
		gchar* _tmp8_;
		_tmp8_ = g_strdup (uri);
		_g_free0 (nuri);
		nuri = _tmp8_;
	}
	{
		GeeIterator* _a_it = NULL;
		GeeMap* _tmp9_;
		GeeMap* _tmp10_;
		GeeMap* _tmp11_;
		GeeCollection* _tmp12_;
		GeeCollection* _tmp13_;
		GeeCollection* _tmp14_;
		GeeIterator* _tmp15_;
		GeeIterator* _tmp16_;
		_tmp9_ = gxml_tnode_get_attrs ((GXmlTNode*) self);
		_tmp10_ = _tmp9_;
		_tmp11_ = _tmp10_;
		_tmp12_ = gee_map_get_values (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp14_ = _tmp13_;
		_tmp15_ = gee_iterable_iterator ((GeeIterable*) _tmp14_);
		_tmp16_ = _tmp15_;
		_g_object_unref0 (_tmp14_);
		_g_object_unref0 (_tmp11_);
		_a_it = _tmp16_;
		while (TRUE) {
			GeeIterator* _tmp17_;
			GXmlNode* a = NULL;
			GeeIterator* _tmp18_;
			gpointer _tmp19_;
			GXmlNode* _tmp20_;
			gchar* _tmp21_;
			gchar* _tmp22_;
			gchar* _tmp23_;
			gboolean _tmp24_;
			_tmp17_ = _a_it;
			if (!gee_iterator_next (_tmp17_)) {
				break;
			}
			_tmp18_ = _a_it;
			_tmp19_ = gee_iterator_get (_tmp18_);
			a = (GXmlNode*) _tmp19_;
			_tmp20_ = a;
			_tmp21_ = gxml_node_get_name (_tmp20_);
			_tmp22_ = _tmp21_;
			_tmp23_ = _tmp22_;
			_tmp24_ = g_strcmp0 (_tmp23_, name) == 0;
			_g_free0 (_tmp23_);
			if (_tmp24_) {
				GXmlNode* _tmp25_;
				GXmlNamespace* _tmp26_;
				GXmlNamespace* _tmp27_;
				GXmlNamespace* _tmp28_;
				gboolean _tmp29_;
				_tmp25_ = a;
				_tmp26_ = gxml_attribute_get_namespace (G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, GXML_TYPE_ATTRIBUTE, GXmlAttribute));
				_tmp27_ = _tmp26_;
				_tmp28_ = _tmp27_;
				_tmp29_ = _tmp28_ != NULL;
				_g_object_unref0 (_tmp28_);
				if (_tmp29_) {
					GXmlNode* _tmp30_;
					GXmlNamespace* _tmp31_;
					GXmlNamespace* _tmp32_;
					GXmlNamespace* _tmp33_;
					gchar* _tmp34_;
					gchar* _tmp35_;
					gchar* _tmp36_;
					const gchar* _tmp37_;
					gboolean _tmp38_;
					_tmp30_ = a;
					_tmp31_ = gxml_attribute_get_namespace (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, GXML_TYPE_ATTRIBUTE, GXmlAttribute));
					_tmp32_ = _tmp31_;
					_tmp33_ = _tmp32_;
					_tmp34_ = gxml_namespace_get_uri (_tmp33_);
					_tmp35_ = _tmp34_;
					_tmp36_ = _tmp35_;
					_tmp37_ = nuri;
					_tmp38_ = g_strcmp0 (_tmp36_, _tmp37_) == 0;
					_g_free0 (_tmp36_);
					_g_object_unref0 (_tmp33_);
					if (_tmp38_) {
						GeeMap* _tmp39_;
						GeeMap* _tmp40_;
						GeeMap* _tmp41_;
						const gchar* _tmp42_;
						gchar* _tmp43_;
						gchar* _tmp44_;
						GXmlNode* _tmp45_;
						gchar* _tmp46_;
						gchar* _tmp47_;
						gchar* _tmp48_;
						gchar* _tmp49_;
						gchar* _tmp50_;
						_tmp39_ = gxml_tnode_get_attrs ((GXmlTNode*) self);
						_tmp40_ = _tmp39_;
						_tmp41_ = _tmp40_;
						_tmp42_ = prefix;
						_tmp43_ = g_strconcat (_tmp42_, ":", NULL);
						_tmp44_ = _tmp43_;
						_tmp45_ = a;
						_tmp46_ = gxml_node_get_name (_tmp45_);
						_tmp47_ = _tmp46_;
						_tmp48_ = _tmp47_;
						_tmp49_ = g_strconcat (_tmp44_, _tmp48_, NULL);
						_tmp50_ = _tmp49_;
						gee_map_unset (_tmp41_, _tmp50_, NULL);
						_g_free0 (_tmp50_);
						_g_free0 (_tmp48_);
						_g_free0 (_tmp44_);
						_g_object_unref0 (_tmp41_);
					}
				}
			}
			_g_object_unref0 (a);
		}
		_g_object_unref0 (_a_it);
	}
	_g_free0 (nuri);
	_g_free0 (prefix);
}

static void
gxml_telement_real_normalize (GXmlElement* base)
{
	GXmlTElement * self;
	self = (GXmlTElement*) base;
}

static void
gxml_telement_calculate_content (GXmlTElement* self)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup ("");
	_g_free0 (self->priv->_content);
	self->priv->_content = _tmp0_;
	{
		GeeBidirList* _n_list = NULL;
		GeeBidirList* _tmp1_;
		GeeBidirList* _tmp2_;
		gint _n_size = 0;
		GeeBidirList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _n_index = 0;
		_tmp1_ = gxml_tnode_get_children_nodes ((GXmlTNode*) self);
		_tmp2_ = _tmp1_;
		_n_list = _tmp2_;
		_tmp3_ = _n_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_n_size = _tmp5_;
		_n_index = -1;
		while (TRUE) {
			GXmlNode* n = NULL;
			GeeBidirList* _tmp6_;
			gpointer _tmp7_;
			GXmlNode* _tmp8_;
			_n_index = _n_index + 1;
			if (!(_n_index < _n_size)) {
				break;
			}
			_tmp6_ = _n_list;
			_tmp7_ = gee_list_get ((GeeList*) _tmp6_, _n_index);
			n = (GXmlNode*) _tmp7_;
			_tmp8_ = n;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, GXML_TYPE_TEXT)) {
				const gchar* _tmp9_;
				GXmlNode* _tmp10_;
				gchar* _tmp11_;
				gchar* _tmp12_;
				gchar* _tmp13_;
				gchar* _tmp14_;
				_tmp9_ = self->priv->_content;
				_tmp10_ = n;
				_tmp11_ = gxml_node_get_value (_tmp10_);
				_tmp12_ = _tmp11_;
				_tmp13_ = _tmp12_;
				_tmp14_ = g_strconcat (_tmp9_, _tmp13_, NULL);
				_g_free0 (self->priv->_content);
				self->priv->_content = _tmp14_;
				_g_free0 (_tmp13_);
			}
			_g_object_unref0 (n);
		}
		_g_object_unref0 (_n_list);
	}
}

static void
gxml_telement_update_content (GXmlTElement* self,
                              const gchar* val)
{
	g_return_if_fail (self != NULL);
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GeeBidirList* _tmp2_;
				GeeBidirList* _tmp3_;
				GeeBidirList* _tmp4_;
				gint _tmp5_;
				gint _tmp6_;
				gboolean _tmp7_;
				GXmlNode* n = NULL;
				GeeBidirList* _tmp8_;
				GeeBidirList* _tmp9_;
				GeeBidirList* _tmp10_;
				gpointer _tmp11_;
				GXmlNode* _tmp12_;
				GXmlNode* _tmp13_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = gxml_tnode_get_children_nodes ((GXmlTNode*) self);
				_tmp3_ = _tmp2_;
				_tmp4_ = _tmp3_;
				_tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_);
				_tmp6_ = _tmp5_;
				_tmp7_ = !(i < _tmp6_);
				_g_object_unref0 (_tmp4_);
				if (_tmp7_) {
					break;
				}
				_tmp8_ = gxml_tnode_get_children_nodes ((GXmlTNode*) self);
				_tmp9_ = _tmp8_;
				_tmp10_ = _tmp9_;
				_tmp11_ = gee_list_get ((GeeList*) _tmp10_, i);
				_tmp12_ = (GXmlNode*) _tmp11_;
				_g_object_unref0 (_tmp10_);
				n = _tmp12_;
				_tmp13_ = n;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp13_, GXML_TYPE_TEXT)) {
					GeeBidirList* _tmp14_;
					GeeBidirList* _tmp15_;
					GeeBidirList* _tmp16_;
					gpointer _tmp17_;
					GXmlNode* _tmp18_;
					_tmp14_ = gxml_tnode_get_children_nodes ((GXmlTNode*) self);
					_tmp15_ = _tmp14_;
					_tmp16_ = _tmp15_;
					_tmp17_ = gee_list_remove_at ((GeeList*) _tmp16_, i);
					_tmp18_ = (GXmlNode*) _tmp17_;
					_g_object_unref0 (_tmp18_);
					_g_object_unref0 (_tmp16_);
				}
				_g_object_unref0 (n);
			}
		}
	}
	if (val != NULL) {
		GXmlNode* t = NULL;
		GXmlDocument* _tmp19_;
		GXmlDocument* _tmp20_;
		GXmlNode* _tmp21_;
		GeeBidirList* _tmp22_;
		GeeBidirList* _tmp23_;
		GeeBidirList* _tmp24_;
		GXmlNode* _tmp25_;
		_tmp19_ = gxml_tnode_get_document ((GXmlTNode*) self);
		_tmp20_ = _tmp19_;
		_tmp21_ = gxml_document_create_text (_tmp20_, val);
		t = _tmp21_;
		_tmp22_ = gxml_tnode_get_children_nodes ((GXmlTNode*) self);
		_tmp23_ = _tmp22_;
		_tmp24_ = _tmp23_;
		_tmp25_ = t;
		gee_collection_add ((GeeCollection*) _tmp24_, _tmp25_);
		_g_object_unref0 (_tmp24_);
		_g_object_unref0 (t);
	}
}

static gchar*
gxml_telement_real_get_value (GXmlTNode* base)
{
	gchar* result;
	GXmlTElement* self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlTElement*) base;
	gxml_telement_calculate_content (self);
	_tmp0_ = self->priv->_content;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
gxml_telement_real_set_value (GXmlTNode* base,
                              const gchar* value)
{
	GXmlTElement* self;
	self = (GXmlTElement*) base;
	gxml_telement_update_content (self, value);
	g_object_notify_by_pspec ((GObject *) self, gxml_telement_properties[GXML_TELEMENT_VALUE_PROPERTY]);
}

static GeeMap*
gxml_telement_real_get_attrs (GXmlTNode* base)
{
	GeeMap* result;
	GXmlTElement* self;
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp2_;
	GObject* _tmp3_;
	GeeMap* _tmp4_;
	self = (GXmlTElement*) base;
	_tmp0_ = self->_attrs;
	if (_tmp0_ == NULL) {
		GeeHashMap* _tmp1_;
		_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, GXML_TYPE_NODE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		_g_object_unref0 (self->_attrs);
		self->_attrs = _tmp1_;
	}
	_tmp2_ = self->_attrs;
	_tmp3_ = g_object_ref ((GObject*) _tmp2_);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, GEE_TYPE_MAP) ? ((GeeMap*) _tmp3_) : NULL);
	result = _tmp4_;
	return result;
}

static GeeBidirList*
gxml_telement_real_get_children_nodes (GXmlTNode* base)
{
	GeeBidirList* result;
	GXmlTElement* self;
	GXmlTNodeTChildrenList* _tmp0_;
	GXmlTNodeTChildrenList* _tmp2_;
	GObject* _tmp3_;
	GeeBidirList* _tmp4_;
	self = (GXmlTElement*) base;
	_tmp0_ = self->_children;
	if (_tmp0_ == NULL) {
		GXmlTNodeTChildrenList* _tmp1_;
		_tmp1_ = gxml_tnode_tchildren_list_new ((GXmlNode*) self);
		_g_object_unref0 (self->_children);
		self->_children = _tmp1_;
	}
	_tmp2_ = self->_children;
	_tmp3_ = g_object_ref ((GObject*) _tmp2_);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, GEE_TYPE_BIDIR_LIST) ? ((GeeBidirList*) _tmp3_) : NULL);
	result = _tmp4_;
	return result;
}

static GeeList*
gxml_telement_real_get_namespaces (GXmlTNode* base)
{
	GeeList* result;
	GXmlTElement* self;
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp2_;
	GObject* _tmp3_;
	GeeList* _tmp4_;
	self = (GXmlTElement*) base;
	_tmp0_ = self->_namespaces;
	if (_tmp0_ == NULL) {
		GeeArrayList* _tmp1_;
		_tmp1_ = gee_array_list_new (GXML_TYPE_NODE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
		_g_object_unref0 (self->_namespaces);
		self->_namespaces = _tmp1_;
	}
	_tmp2_ = self->_namespaces;
	_tmp3_ = g_object_ref ((GObject*) _tmp2_);
	_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, GEE_TYPE_LIST) ? ((GeeList*) _tmp3_) : NULL);
	result = _tmp4_;
	return result;
}

static gchar*
gxml_telement_real_get_content (GXmlElement* base)
{
	gchar* result;
	GXmlTElement* self;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlTElement*) base;
	gxml_telement_calculate_content (self);
	_tmp0_ = self->priv->_content;
	_tmp1_ = g_strdup (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
gxml_telement_real_set_content (GXmlElement* base,
                                const gchar* value)
{
	GXmlTElement* self;
	self = (GXmlTElement*) base;
	gxml_telement_update_content (self, value);
	g_object_notify_by_pspec ((GObject *) self, gxml_telement_properties[GXML_TELEMENT_CONTENT_PROPERTY]);
}

static gchar*
gxml_telement_real_get_tag_name (GXmlElement* base)
{
	gchar* result;
	GXmlTElement* self;
	gchar* _tmp0_;
	gchar* _tmp1_;
	self = (GXmlTElement*) base;
	_tmp0_ = gxml_tnode_get_name ((GXmlTNode*) self);
	_tmp1_ = _tmp0_;
	result = _tmp1_;
	return result;
}

static GObject *
gxml_telement_constructor (GType type,
                           guint n_construct_properties,
                           GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	GXmlTElement * self;
	parent_class = G_OBJECT_CLASS (gxml_telement_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_TELEMENT, GXmlTElement);
	((GXmlTNode*) self)->_node_type = GXML_NODE_TYPE_ELEMENT;
	return obj;
}

static void
gxml_telement_class_init (GXmlTElementClass * klass,
                          gpointer klass_data)
{
	gxml_telement_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &GXmlTElement_private_offset);
	GXML_TNODE_CLASS (klass)->get_value = gxml_telement_real_get_value;
	GXML_TNODE_CLASS (klass)->set_value = gxml_telement_real_set_value;
	GXML_TNODE_CLASS (klass)->get_attrs = gxml_telement_real_get_attrs;
	GXML_TNODE_CLASS (klass)->get_children_nodes = gxml_telement_real_get_children_nodes;
	GXML_TNODE_CLASS (klass)->get_namespaces = gxml_telement_real_get_namespaces;
	G_OBJECT_CLASS (klass)->get_property = _vala_gxml_telement_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_gxml_telement_set_property;
	G_OBJECT_CLASS (klass)->constructor = gxml_telement_constructor;
	G_OBJECT_CLASS (klass)->finalize = gxml_telement_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_TELEMENT_VALUE_PROPERTY, gxml_telement_properties[GXML_TELEMENT_VALUE_PROPERTY] = g_param_spec_string ("value", "value", "value", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_TELEMENT_ATTRS_PROPERTY, gxml_telement_properties[GXML_TELEMENT_ATTRS_PROPERTY] = g_param_spec_object ("attrs", "attrs", "attrs", GEE_TYPE_MAP, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_TELEMENT_CHILDREN_NODES_PROPERTY, gxml_telement_properties[GXML_TELEMENT_CHILDREN_NODES_PROPERTY] = g_param_spec_object ("children-nodes", "children-nodes", "children-nodes", GEE_TYPE_BIDIR_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_TELEMENT_NAMESPACES_PROPERTY, gxml_telement_properties[GXML_TELEMENT_NAMESPACES_PROPERTY] = g_param_spec_object ("namespaces", "namespaces", "namespaces", GEE_TYPE_LIST, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_TELEMENT_CONTENT_PROPERTY, gxml_telement_properties[GXML_TELEMENT_CONTENT_PROPERTY] = g_param_spec_string ("content", "content", "content", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), GXML_TELEMENT_TAG_NAME_PROPERTY, gxml_telement_properties[GXML_TELEMENT_TAG_NAME_PROPERTY] = g_param_spec_string ("tag-name", "tag-name", "tag-name", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
gxml_telement_gxml_element_interface_init (GXmlElementIface * iface,
                                           gpointer iface_data)
{
	gxml_telement_gxml_element_parent_iface = g_type_interface_peek_parent (iface);
	iface->set_attr = (void (*) (GXmlElement*, const gchar*, const gchar*)) gxml_telement_real_set_attr;
	iface->get_attr = (GXmlNode* (*) (GXmlElement*, const gchar*)) gxml_telement_real_get_attr;
	iface->get_ns_attr = (GXmlNode* (*) (GXmlElement*, const gchar*, const gchar*)) gxml_telement_real_get_ns_attr;
	iface->set_ns_attr = (void (*) (GXmlElement*, const gchar*, const gchar*, const gchar*)) gxml_telement_real_set_ns_attr;
	iface->remove_attr = (void (*) (GXmlElement*, const gchar*)) gxml_telement_real_remove_attr;
	iface->remove_ns_attr = (void (*) (GXmlElement*, const gchar*, const gchar*)) gxml_telement_real_remove_ns_attr;
	iface->normalize = (void (*) (GXmlElement*)) gxml_telement_real_normalize;
	iface->get_content = gxml_telement_real_get_content;
	iface->set_content = gxml_telement_real_set_content;
	iface->get_tag_name = gxml_telement_real_get_tag_name;
}

static void
gxml_telement_instance_init (GXmlTElement * self,
                             gpointer klass)
{
	self->priv = gxml_telement_get_instance_private (self);
	self->priv->_content = NULL;
}

static void
gxml_telement_finalize (GObject * obj)
{
	GXmlTElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GXML_TYPE_TELEMENT, GXmlTElement);
	_g_object_unref0 (self->_attrs);
	_g_object_unref0 (self->_children);
	_g_object_unref0 (self->_namespaces);
	_g_free0 (self->priv->_content);
	G_OBJECT_CLASS (gxml_telement_parent_class)->finalize (obj);
}

/**
 * DOM1 Class implemeting {@link GXml.Element} interface, not tied to libxml-2.0 library.
 */
GType
gxml_telement_get_type (void)
{
	static volatile gsize gxml_telement_type_id__volatile = 0;
	if (g_once_init_enter (&gxml_telement_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GXmlTElementClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gxml_telement_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GXmlTElement), 0, (GInstanceInitFunc) gxml_telement_instance_init, NULL };
		static const GInterfaceInfo gxml_element_info = { (GInterfaceInitFunc) gxml_telement_gxml_element_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType gxml_telement_type_id;
		gxml_telement_type_id = g_type_register_static (GXML_TYPE_TNODE, "GXmlTElement", &g_define_type_info, 0);
		g_type_add_interface_static (gxml_telement_type_id, GXML_TYPE_ELEMENT, &gxml_element_info);
		GXmlTElement_private_offset = g_type_add_instance_private (gxml_telement_type_id, sizeof (GXmlTElementPrivate));
		g_once_init_leave (&gxml_telement_type_id__volatile, gxml_telement_type_id);
	}
	return gxml_telement_type_id__volatile;
}

static void
_vala_gxml_telement_get_property (GObject * object,
                                  guint property_id,
                                  GValue * value,
                                  GParamSpec * pspec)
{
	GXmlTElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_TELEMENT, GXmlTElement);
	switch (property_id) {
		case GXML_TELEMENT_VALUE_PROPERTY:
		g_value_take_string (value, gxml_tnode_get_value ((GXmlTNode*) self));
		break;
		case GXML_TELEMENT_ATTRS_PROPERTY:
		g_value_take_object (value, gxml_tnode_get_attrs ((GXmlTNode*) self));
		break;
		case GXML_TELEMENT_CHILDREN_NODES_PROPERTY:
		g_value_take_object (value, gxml_tnode_get_children_nodes ((GXmlTNode*) self));
		break;
		case GXML_TELEMENT_NAMESPACES_PROPERTY:
		g_value_take_object (value, gxml_tnode_get_namespaces ((GXmlTNode*) self));
		break;
		case GXML_TELEMENT_CONTENT_PROPERTY:
		g_value_take_string (value, gxml_element_get_content ((GXmlElement*) self));
		break;
		case GXML_TELEMENT_TAG_NAME_PROPERTY:
		g_value_take_string (value, gxml_element_get_tag_name ((GXmlElement*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_gxml_telement_set_property (GObject * object,
                                  guint property_id,
                                  const GValue * value,
                                  GParamSpec * pspec)
{
	GXmlTElement * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, GXML_TYPE_TELEMENT, GXmlTElement);
	switch (property_id) {
		case GXML_TELEMENT_VALUE_PROPERTY:
		gxml_tnode_set_value ((GXmlTNode*) self, g_value_get_string (value));
		break;
		case GXML_TELEMENT_CONTENT_PROPERTY:
		gxml_element_set_content ((GXmlElement*) self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gint array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gint array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gint
_vala_array_length (gpointer array)
{
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

