GXmlxNode

GXmlxNode — Represents an XML xNode, the base class for most XML structures in the GXmlxDocument's tree.

Functions

Types and Values

#define GXML_TYPE_XNODE
struct GXmlxNode
struct GXmlxNodeClass

Description

GXmlxDocuments are GXmlxNodes, and are composed of a tree of GXmlxNodes.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-1950641247

Functions

gxml_xnode_add_namespace_attr ()

GXmlNamespaceAttr *
gxml_xnode_add_namespace_attr (GXmlxNode *self,
                               const gchar *uri,
                               const gchar *namespace_prefix);

Add a new namespace to this GXmlxNode

Parameters

self

the GXmlxNode instance

 

uri

 

 

namespace_prefix

 

 

gxml_xnode_set_namespace ()

gboolean
gxml_xnode_set_namespace (GXmlxNode *self,
                          const gchar *uri,
                          const gchar *namespace_prefix);

Set namespace to this GXmlxNode

Returns: true if namespace exists.

Parameters

self

the GXmlxNode instance

 

uri

 

 

namespace_prefix

 

 

gxml_xnode_insert_before ()

GXmlxNode *
gxml_xnode_insert_before (GXmlxNode *self,
                          GXmlxNode *new_child,
                          GXmlxNode *ref_child);

Insert new_child as a child to this node, and place it in the list before ref_child.

If ref_child is NULL, new_child is appended to the list of children instead.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-insertBefore

Parameters

self

the GXmlxNode instance

 

new_child

 .

A new GXmlxNode that will become a child of the current one

.

[in]

ref_child

 .

The child that new_child will be placed ahead of

.

[in][allow-none]

Returns

new_child, the node that has been inserted. Do not free it, its memory will be released when the owning GXmlxDocument is freed.


gxml_xnode_replace_child ()

GXmlxNode *
gxml_xnode_replace_child (GXmlxNode *self,
                          GXmlxNode *new_child,
                          GXmlxNode *old_child);

Replaces old_child with new_child in this node's list of children.

Version: DOM Level 1 Core URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-replaceChild

Parameters

self

the GXmlxNode instance

 

new_child

 .

A new GXmlxNode that will become a child of the current one

.

[in]

old_child

 .

A GXmlxNode that will be removed and replaced by new_child

.

[in]

Returns

The removed node old_child. Do not free it, its memory will be released when the owning GXmlxDocument is freed.


gxml_xnode_remove_child ()

GXmlxNode *
gxml_xnode_remove_child (GXmlxNode *self,
                         GXmlxNode *old_child);

Removes old_child from this node's list of children, "child-nodes".

Version: DOM Level 1 Core URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-removeChild

Parameters

self

the GXmlxNode instance

 

old_child

 .

The GXmlxNode child to remove from the current one

.

[in]

Returns

The removed node old_child. Do not free it, its memory will be released when the owning GXmlxDocument is freed


gxml_xnode_append_child ()

GXmlxNode *
gxml_xnode_append_child (GXmlxNode *self,
                         GXmlxNode *new_child);

Appends new_child to the end of this node's list of children, "child-nodes".

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-appendChild

Parameters

self

the GXmlxNode instance

 

new_child

 .

A new GXmlxNode that will become the last child of this current node

.

[in]

Returns

The newly added child, new_child. Do not free it, its memory will be released when the owning GXmlxDocument is freed.


gxml_xnode_has_child_nodes ()

gboolean
gxml_xnode_has_child_nodes (GXmlxNode *self);

Indicates whether this node has children.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-hasChildNodes

Parameters

self

the GXmlxNode instance

 

Returns

true if this node has children, false if not


gxml_xnode_clone_node ()

GXmlxNode *
gxml_xnode_clone_node (GXmlxNode *self,
                       gboolean deep);

Creates a parentless copy of this node.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#method-cloneNode

Parameters

self

the GXmlxNode instance

 

deep

 .

If true, descendants are cloned as well. If false, they are not

.

[in]

Returns

A parentless clone of this node. Do not free it, its memory will be released when the owning GXmlxDocument is freed.


gxml_xnode_stringify ()

gchar *
gxml_xnode_stringify (GXmlxNode *self,
                      gboolean format,
                      gint level);

Provides a string representation of this node.

Note that if the DOM tree contains a Text node, a CDATA section, or an EntityRef, it will not be formatted, since the current implementation with libxml2 will not handle that case. (See libxml2's xmlNodeDumpOutput internals to understand more.)

Parameters

self

the GXmlxNode instance

 

format

 .

FALSE: no formatting, true: formatted, with indentation

.

[in]

level

 .

Indentation level

.

[in]

Returns

XML string for node, which must be free this.


gxml_xnode_to_string ()

gchar *
gxml_xnode_to_string (GXmlxNode *self);

Parameters

self

the GXmlxNode instance

 

gxml_xnode_get_namespace_definitions ()

GeeList *
gxml_xnode_get_namespace_definitions (GXmlxNode *self);

Get and return the current value of the "namespace-definitions" property.

The list of attributes that store namespace definitions. This is not part of a DOM spec.

The caller must free this using g_object_unref().

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "namespace-definitions" property


gxml_xnode_get_namespace_uri ()

const gchar *
gxml_xnode_get_namespace_uri (GXmlxNode *self);

Get and return the current value of the "namespace-uri" property.

Stores the URI describing the node's namespace. This only applies to Elements and Attrs from DOM Level 2 Core that were created with namespace support.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 2 Core

URL: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-NodeNSname

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "namespace-uri" property


gxml_xnode_get_namespace_prefix ()

const gchar *
gxml_xnode_get_namespace_prefix (GXmlxNode *self);

Get and return the current value of the "namespace-prefix" property.

Stores the namespace prefix for the node. This only applies to Elements and Attrs from DOM Level 2 Core that were created with namespace support.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 2 Core

URL: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-NodeNSPrefix

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "namespace-prefix" property


gxml_xnode_get_local_name ()

const gchar *
gxml_xnode_get_local_name (GXmlxNode *self);

Get and return the current value of the "local-name" property.

Stores the local name within the namespace. This only applies to Elements and Attrs from DOM Level 2 Core that were created with namespace support.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 2 Core

URL: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-NodeNSLocalN

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "local-name" property


gxml_xnode_get_node_name ()

const gchar *
gxml_xnode_get_node_name (GXmlxNode *self);

Get and return the current value of the "node-name" property.

Stores the name of the node. Sometimes this is similar to the node type, but sometimes, it is arbitrary data, like for GXmlAttribute where the node_name is the name of the Attr's name=value pair.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-F68D095

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "node-name" property


gxml_xnode_get_node_value ()

const gchar *
gxml_xnode_get_node_value (GXmlxNode *self);

Get and return the current value of the "node-value" property.

Stores the value of the xNode. The nature of node_value varies based on the type of node. This can be NULL.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-F68D080

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "node-value" property


gxml_xnode_get_node_type ()

GXmlNodeType
gxml_xnode_get_node_type (GXmlxNode *self);

Get and return the current value of the "node-type" property.

Stores the type of node. Most XML structures are nodes of different types, like GXmlxDocument as a GXML_NODE_TYPE_DOCUMENT, GXmlAttribute as a GXML_NODE_TYPE_ATTRIBUTE, Element as a GXML_NODE_TYPE_ELEMENT, etc.

Version: DOM Level 1 Core URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-111237558

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "node-type" property


gxml_xnode_get_parent_node ()

GXmlxNode *
gxml_xnode_get_parent_node (GXmlxNode *self);

Get and return the current value of the "parent-node" property.

A link to the parent_node of this node. For example, with elements, the immediate, outer element is the parent.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-1060184317

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "parent-node" property


gxml_xnode_get_child_nodes ()

GXmlxNodeList *
gxml_xnode_get_child_nodes (GXmlxNode *self);

Get and return the current value of the "child-nodes" property.

List of child nodes to this node. These sometimes represent the value of a node as a tree of GXmlxNode, whereas node_value represents it as a string. This can be NULL for node types that have no children.

The GXmlNodeList is live, in that changes to this node's children will be reflected in an already-active GXmlNodeList.

The caller must call g_object_unref() on the list when it is done with it. The lists are constructed dynamically.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-1451460987

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "child-nodes" property


gxml_xnode_get_first_child ()

GXmlxNode *
gxml_xnode_get_first_child (GXmlxNode *self);

Get and return the current value of the "first-child" property.

Links to the first child. If there are no children, it returns NULL.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-169727388

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "first-child" property


gxml_xnode_get_last_child ()

GXmlxNode *
gxml_xnode_get_last_child (GXmlxNode *self);

Get and return the current value of the "last-child" property.

Links to the last child. If there are no children, it returns NULL.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-61AD09FB

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "last-child" property


gxml_xnode_get_previous_sibling ()

GXmlxNode *
gxml_xnode_get_previous_sibling (GXmlxNode *self);

Get and return the current value of the "previous-sibling" property.

Links to this node's preceding sibling. If there are no previous siblings, it returns NULL. Note that the children of a node are ordered.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-640FB3C8

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "previous-sibling" property


gxml_xnode_get_next_sibling ()

GXmlxNode *
gxml_xnode_get_next_sibling (GXmlxNode *self);

Get and return the current value of the "next-sibling" property.

Links to this node's next sibling. If there is no next sibling, it returns NULL. Note that the children of a node are ordered.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-6AC54C2F

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "next-sibling" property


gxml_xnode_get_attributes ()

GXmlNamedAttrMap *
gxml_xnode_get_attributes (GXmlxNode *self);

Get and return the current value of the "attributes" property.

A GXmlNamedNodeMap containing the GXmlAttribute attributes for this node. attributes actually only apply to GXmlElement nodes. For all other GXmlxNode subclasses, attributes is NULL.

Do not free this. It's memory will be released when the owning GXmlxDocument is freed.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-84CF09

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "attributes" property


gxml_xnode_get_owner_document ()

GXmlxDocument *
gxml_xnode_get_owner_document (GXmlxNode *self);

Get and return the current value of the "owner-document" property.

A link to the GXmlxDocument to which this node belongs.

Do not free this unless you intend to free all memory owned by the GXmlxDocument, including this GXmlxNode.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#node-ownerDoc

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "owner-document" property


gxml_xnode_get_namespaces ()

GeeList *
gxml_xnode_get_namespaces (GXmlxNode *self);

Get and return the current value of the "namespaces" property.

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "namespaces" property


gxml_xnode_get_children_nodes ()

GeeBidirList *
gxml_xnode_get_children_nodes (GXmlxNode *self);

Get and return the current value of the "children-nodes" property.

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "children-nodes" property


gxml_xnode_get_attrs ()

GeeMap *
gxml_xnode_get_attrs (GXmlxNode *self);

Get and return the current value of the "attrs" property.

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "attrs" property


gxml_xnode_get_name ()

gchar *
gxml_xnode_get_name (GXmlxNode *self);

Get and return the current value of the "name" property.

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "name" property


gxml_xnode_get_value ()

gchar *
gxml_xnode_get_value (GXmlxNode *self);

Get and return the current value of the "value" property.

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "value" property


gxml_xnode_set_value ()

void
gxml_xnode_set_value (GXmlxNode *self,
                      const gchar *value);

Set the value of the "value" property to value .

Parameters

self

the GXmlxNode instance to modify

 

value

the new value of the "value" property

 

gxml_xnode_get_parent ()

GXmlNode *
gxml_xnode_get_parent (GXmlxNode *self);

Get and return the current value of the "parent" property.

Parameters

self

the GXmlxNode instance to query

 

Returns

the value of the "parent" property

Types and Values

GXML_TYPE_XNODE

#define GXML_TYPE_XNODE (gxml_xnode_get_type ())

The type for GXmlxNode.


struct GXmlxNode

struct GXmlxNode {
	GObject parent_instance;
	GXmlxNodePrivate * priv;
	GXmlxNodeList* _child_nodes;
	GXmlNamedAttrMap* _attributes;
	GXmlNamespaceAttrNodeList* _namespace_definitions;
};

Represents an XML xNode, the base class for most XML structures in the GXmlxDocument's tree.

GXmlxDocuments are GXmlxNodes, and are composed of a tree of GXmlxNodes.

Version: DOM Level 1 Core

URL: http://www.w3.org/TR/DOM-Level-1/level-one-core.html#ID-1950641247


struct GXmlxNodeClass

struct GXmlxNodeClass {
	GObjectClass parent_class;
	GXmlNamespaceAttr* (*add_namespace_attr) (GXmlxNode* self, const gchar* uri, const gchar* namespace_prefix);
	gboolean (*set_namespace) (GXmlxNode* self, const gchar* uri, const gchar* namespace_prefix);
	GXmlxNode* (*insert_before) (GXmlxNode* self, GXmlxNode* new_child, GXmlxNode* ref_child);
	GXmlxNode* (*replace_child) (GXmlxNode* self, GXmlxNode* new_child, GXmlxNode* old_child);
	GXmlxNode* (*remove_child) (GXmlxNode* self, GXmlxNode* old_child);
	GXmlxNode* (*append_child) (GXmlxNode* self, GXmlxNode* new_child);
	gboolean (*has_child_nodes) (GXmlxNode* self);
	GXmlxNode* (*clone_node) (GXmlxNode* self, gboolean deep);
	gchar* (*stringify) (GXmlxNode* self, gboolean format, gint level);
	gchar* (*to_string) (GXmlxNode* self);
	GeeList* (*get_namespace_definitions) (GXmlxNode* self);
	void (*set_namespace_definitions) (GXmlxNode* self, GeeList* value);
	const gchar* (*get_namespace_uri) (GXmlxNode* self);
	void (*set_namespace_uri) (GXmlxNode* self, const gchar* value);
	const gchar* (*get_namespace_prefix) (GXmlxNode* self);
	void (*set_namespace_prefix) (GXmlxNode* self, const gchar* value);
	const gchar* (*get_local_name) (GXmlxNode* self);
	void (*set_local_name) (GXmlxNode* self, const gchar* value);
	const gchar* (*get_node_name) (GXmlxNode* self);
	void (*set_node_name) (GXmlxNode* self, const gchar* value);
	const gchar* (*get_node_value) (GXmlxNode* self);
	void (*set_node_value) (GXmlxNode* self, const gchar* value);
	GXmlNodeType (*get_node_type) (GXmlxNode* self);
	void (*set_node_type) (GXmlxNode* self, GXmlNodeType value);
	GXmlxNode* (*get_parent_node) (GXmlxNode* self);
	void (*set_parent_node) (GXmlxNode* self, GXmlxNode* value);
	GXmlxNodeList* (*get_child_nodes) (GXmlxNode* self);
	void (*set_child_nodes) (GXmlxNode* self, GXmlxNodeList* value);
	GXmlxNode* (*get_first_child) (GXmlxNode* self);
	void (*set_first_child) (GXmlxNode* self, GXmlxNode* value);
	GXmlxNode* (*get_last_child) (GXmlxNode* self);
	void (*set_last_child) (GXmlxNode* self, GXmlxNode* value);
	GXmlxNode* (*get_previous_sibling) (GXmlxNode* self);
	void (*set_previous_sibling) (GXmlxNode* self, GXmlxNode* value);
	GXmlxNode* (*get_next_sibling) (GXmlxNode* self);
	void (*set_next_sibling) (GXmlxNode* self, GXmlxNode* value);
	GXmlNamedAttrMap* (*get_attributes) (GXmlxNode* self);
	void (*set_attributes) (GXmlxNode* self, GXmlNamedAttrMap* value);
	GeeList* (*get_namespaces) (GXmlxNode* self);
	GeeBidirList* (*get_children_nodes) (GXmlxNode* self);
	GeeMap* (*get_attrs) (GXmlxNode* self);
	gchar* (*get_name) (GXmlxNode* self);
	gchar* (*get_value) (GXmlxNode* self);
	void (*set_value) (GXmlxNode* self, const gchar* value);
	GXmlNode* (*get_parent) (GXmlxNode* self);
};

The class structure for GXML_TYPE_XNODE. All the fields in this structure are private and should never be accessed directly.

Members

add_namespace_attr ()

virtual method called by gxml_xnode_add_namespace_attr()

 

set_namespace ()

virtual method called by gxml_xnode_set_namespace()

 

insert_before ()

virtual method called by gxml_xnode_insert_before()

 

replace_child ()

virtual method called by gxml_xnode_replace_child()

 

remove_child ()

virtual method called by gxml_xnode_remove_child()

 

append_child ()

virtual method called by gxml_xnode_append_child()

 

has_child_nodes ()

virtual method called by gxml_xnode_has_child_nodes()

 

clone_node ()

virtual method called by gxml_xnode_clone_node()

 

stringify ()

virtual method called by gxml_xnode_stringify()

 

to_string ()

virtual method called by gxml_xnode_to_string()

 

get_namespace_definitions ()

getter method for the abstract property "namespace-definitions"

 

set_namespace_definitions ()

   

get_namespace_uri ()

getter method for the abstract property "namespace-uri"

 

set_namespace_uri ()

   

get_namespace_prefix ()

getter method for the abstract property "namespace-prefix"

 

set_namespace_prefix ()

   

get_local_name ()

getter method for the abstract property "local-name"

 

set_local_name ()

   

get_node_name ()

getter method for the abstract property "node-name"

 

set_node_name ()

   

get_node_value ()

getter method for the abstract property "node-value"

 

set_node_value ()

   

get_node_type ()

getter method for the abstract property "node-type"

 

set_node_type ()

   

get_parent_node ()

getter method for the abstract property "parent-node"

 

set_parent_node ()

   

get_child_nodes ()

getter method for the abstract property "child-nodes"

 

set_child_nodes ()

   

get_first_child ()

getter method for the abstract property "first-child"

 

set_first_child ()

   

get_last_child ()

getter method for the abstract property "last-child"

 

set_last_child ()

   

get_previous_sibling ()

getter method for the abstract property "previous-sibling"

 

set_previous_sibling ()

   

get_next_sibling ()

getter method for the abstract property "next-sibling"

 

set_next_sibling ()

   

get_attributes ()

getter method for the abstract property "attributes"

 

set_attributes ()

   

get_namespaces ()

getter method for the abstract property "namespaces"

 

get_children_nodes ()

getter method for the abstract property "children-nodes"

 

get_attrs ()

getter method for the abstract property "attrs"

 

get_name ()

getter method for the abstract property "name"

 

get_value ()

getter method for the abstract property "value"

 

set_value ()

setter method for the abstract property "value"

 

get_parent ()

getter method for the abstract property "parent"