Struct

PurpleXmlNode

Description [src]

struct PurpleXmlNode {
  char* name;
  char* xmlns;
  PurpleXmlNodeType type;
  char* data;
  size_t data_sz;
  PurpleXmlNode* parent;
  PurpleXmlNode* child;
  PurpleXmlNode* lastchild;
  PurpleXmlNode* next;
  char* prefix;
  GHashTable* namespace_map;
}

XmlNode is a simplified API for handling XML. An XmlNode represents an XML element and has API for children as well as attributes.

Structure members
name

The name of the node.

xmlns

The namespace of the node.

type

The type of the node.

data

The data for the node.

data_sz

The size of the data.

parent

The parent node or NULL.

child

The child node or NULL.

lastchild

The last child node or NULL.

next

The next node or NULL.

prefix

The namespace prefix if any.

namespace_map

The namespace map.

Constructors

purple_xmlnode_new

Creates a new PurpleXmlNode.

Functions

purple_xmlnode_from_file

Creates a node from a XML File. Calling this on the root node of an XML document will parse the entire document into a tree of nodes, and return the PurpleXmlNode of the root.

purple_xmlnode_from_str

Creates a node from a string of XML. Calling this on the root node of an XML document will parse the entire document into a tree of nodes, and return the PurpleXmlNode of the root.

Instance methods

purple_xmlnode_copy

Creates a new node from the source node.

purple_xmlnode_free

Frees a node and all of its children.

purple_xmlnode_get_attrib

Gets an attribute from a node.

purple_xmlnode_get_attrib_with_namespace

Gets a namespaced attribute from a node.

purple_xmlnode_get_child

Gets a child node named name.

purple_xmlnode_get_child_with_namespace

Gets a child node named name in a namespace.

purple_xmlnode_get_data

Gets (escaped) data from a node.

purple_xmlnode_get_data_unescaped

Gets unescaped data from a node.

purple_xmlnode_get_default_namespace

Returns the current default namespace. The default namespace is the current namespace which applies to child elements which are unprefixed and which do not contain their own namespace.

purple_xmlnode_get_namespace

Returns the namespace of a node.

purple_xmlnode_get_next_twin

Gets the next node with the same name as node.

purple_xmlnode_get_parent

Gets the parent node.

purple_xmlnode_get_prefix

Returns the prefix of a node.

purple_xmlnode_get_prefix_namespace

Returns the defined namespace for a prefix.

purple_xmlnode_insert_child

Inserts a node into a node as a child.

purple_xmlnode_insert_data

Inserts data into a node.

purple_xmlnode_new_child

Creates a new PurpleXmlNode child.

purple_xmlnode_remove_attrib

Removes an attribute from a node.

purple_xmlnode_remove_attrib_with_namespace

Removes a namespaced attribute from a node.

purple_xmlnode_set_attrib

Sets an attribute for a node.

purple_xmlnode_set_attrib_full

Sets a namespaced attribute for a node.

purple_xmlnode_set_namespace

Sets the namespace of a node.

purple_xmlnode_set_prefix

Sets the prefix of a node.

purple_xmlnode_strip_prefixes

Remove all element prefixes from an PurpleXmlNode tree. The prefix’s namespace is transformed into the default namespace for an element.

purple_xmlnode_to_formatted_str

Returns the node in a string of human readable xml.

purple_xmlnode_to_str

Returns the node in a string of xml.