pidgin 2.14.14dev
|
XML DOM functions. More...
#include <glib.h>
Go to the source code of this file.
Data Structures | |
struct | _xmlnode |
Typedefs | |
typedef enum _XMLNodeType | XMLNodeType |
The valid types for an xmlnode. | |
typedef struct _xmlnode | xmlnode |
An xmlnode. | |
Enumerations | |
enum | _XMLNodeType { XMLNODE_TYPE_TAG , XMLNODE_TYPE_ATTRIB , XMLNODE_TYPE_DATA } |
The valid types for an xmlnode. More... | |
Functions | |
xmlnode * | xmlnode_new (const char *name) |
Creates a new xmlnode. | |
xmlnode * | xmlnode_new_child (xmlnode *parent, const char *name) |
Creates a new xmlnode child. | |
void | xmlnode_insert_child (xmlnode *parent, xmlnode *child) |
Inserts a node into a node as a child. | |
xmlnode * | xmlnode_get_child (const xmlnode *parent, const char *name) |
Gets a child node named name. | |
xmlnode * | xmlnode_get_child_with_namespace (const xmlnode *parent, const char *name, const char *xmlns) |
Gets a child node named name in a namespace. | |
xmlnode * | xmlnode_get_next_twin (xmlnode *node) |
Gets the next node with the same name as node. | |
void | xmlnode_insert_data (xmlnode *node, const char *data, gssize size) |
Inserts data into a node. | |
char * | xmlnode_get_data (const xmlnode *node) |
Gets (escaped) data from a node. | |
char * | xmlnode_get_data_unescaped (const xmlnode *node) |
Gets unescaped data from a node. | |
void | xmlnode_set_attrib (xmlnode *node, const char *attr, const char *value) |
Sets an attribute for a node. | |
void | xmlnode_set_attrib_with_prefix (xmlnode *node, const char *attr, const char *prefix, const char *value) |
Sets a prefixed attribute for a node. | |
void | xmlnode_set_attrib_with_namespace (xmlnode *node, const char *attr, const char *xmlns, const char *value) |
Sets a namespaced attribute for a node. | |
void | xmlnode_set_attrib_full (xmlnode *node, const char *attr, const char *xmlns, const char *prefix, const char *value) |
Sets a namespaced attribute for a node. | |
const char * | xmlnode_get_attrib (const xmlnode *node, const char *attr) |
Gets an attribute from a node. | |
const char * | xmlnode_get_attrib_with_namespace (const xmlnode *node, const char *attr, const char *xmlns) |
Gets a namespaced attribute from a node. | |
void | xmlnode_remove_attrib (xmlnode *node, const char *attr) |
Removes an attribute from a node. | |
void | xmlnode_remove_attrib_with_namespace (xmlnode *node, const char *attr, const char *xmlns) |
Removes a namespaced attribute from a node. | |
void | xmlnode_set_namespace (xmlnode *node, const char *xmlns) |
Sets the namespace of a node. | |
const char * | xmlnode_get_namespace (xmlnode *node) |
Returns the namespace of a node. | |
void | xmlnode_set_prefix (xmlnode *node, const char *prefix) |
Sets the prefix of a node. | |
const char * | xmlnode_get_prefix (const xmlnode *node) |
Returns the prefix of a node. | |
xmlnode * | xmlnode_get_parent (const xmlnode *child) |
Gets the parent node. | |
char * | xmlnode_to_str (const xmlnode *node, int *len) |
Returns the node in a string of xml. | |
char * | xmlnode_to_formatted_str (const xmlnode *node, int *len) |
Returns the node in a string of human readable xml. | |
xmlnode * | xmlnode_from_str (const char *str, gssize size) |
Creates a node from a string of XML. | |
xmlnode * | xmlnode_copy (const xmlnode *src) |
Creates a new node from the source node. | |
void | xmlnode_free (xmlnode *node) |
Frees a node and all of its children. | |
xmlnode * | xmlnode_from_file (const char *dir, const char *filename, const char *description, const char *process) |
Creates a node from a XML File. | |
XML DOM functions.
Definition in file xmlnode.h.
enum _XMLNodeType |
Creates a new node from the source node.
src | The node to copy. |
void xmlnode_free | ( | xmlnode * | node | ) |
Frees a node and all of its children.
node | The node to free. |
xmlnode * xmlnode_from_file | ( | const char * | dir, |
const char * | filename, | ||
const char * | description, | ||
const char * | process | ||
) |
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 xmlnode of the root.
dir | The directory where the file is located |
filename | The filename |
description | A description of the file being parsed. Displayed to the user if the file cannot be read. |
process | The subsystem that is calling xmlnode_from_file. Used as the category for debugging. |
xmlnode * xmlnode_from_str | ( | const char * | str, |
gssize | size | ||
) |
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 xmlnode of the root.
str | The string of xml. |
size | The size of the string, or -1 if str is NUL-terminated. |
const char * xmlnode_get_attrib | ( | const xmlnode * | node, |
const char * | attr | ||
) |
Gets an attribute from a node.
node | The node to get an attribute from. |
attr | The attribute to get. |
const char * xmlnode_get_attrib_with_namespace | ( | const xmlnode * | node, |
const char * | attr, | ||
const char * | xmlns | ||
) |
Gets a namespaced attribute from a node.
node | The node to get an attribute from. |
attr | The attribute to get |
xmlns | The namespace of the attribute to get |
Gets a child node named name.
parent | The parent node. |
name | The child's name. |
xmlnode * xmlnode_get_child_with_namespace | ( | const xmlnode * | parent, |
const char * | name, | ||
const char * | xmlns | ||
) |
Gets a child node named name in a namespace.
parent | The parent node. |
name | The child's name. |
xmlns | The namespace. |
char * xmlnode_get_data | ( | const xmlnode * | node | ) |
Gets (escaped) data from a node.
node | The node to get data from. |
char * xmlnode_get_data_unescaped | ( | const xmlnode * | node | ) |
Gets unescaped data from a node.
node | The node to get data from. |
const char * xmlnode_get_namespace | ( | xmlnode * | node | ) |
Returns the namespace of a node.
node | The node to get the namepsace from |
Gets the next node with the same name as node.
node | The node of a twin to find. |
Gets the parent node.
child | The child node. |
const char * xmlnode_get_prefix | ( | const xmlnode * | node | ) |
Returns the prefix of a node.
node | The node to get the prefix from |
Inserts a node into a node as a child.
parent | The parent node to insert child into. |
child | The child node to insert into parent. |
void xmlnode_insert_data | ( | xmlnode * | node, |
const char * | data, | ||
gssize | size | ||
) |
Inserts data into a node.
node | The node to insert data into. |
data | The data to insert. |
size | The size of the data to insert. If data is null-terminated you can pass in -1. |
xmlnode * xmlnode_new | ( | const char * | name | ) |
Creates a new xmlnode.
name | The name of the node. |
Creates a new xmlnode child.
parent | The parent node. |
name | The name of the child node. |
void xmlnode_remove_attrib | ( | xmlnode * | node, |
const char * | attr | ||
) |
Removes an attribute from a node.
node | The node to remove an attribute from. |
attr | The attribute to remove. |
void xmlnode_remove_attrib_with_namespace | ( | xmlnode * | node, |
const char * | attr, | ||
const char * | xmlns | ||
) |
Removes a namespaced attribute from a node.
node | The node to remove an attribute from |
attr | The attribute to remove |
xmlns | The namespace of the attribute to remove |
void xmlnode_set_attrib | ( | xmlnode * | node, |
const char * | attr, | ||
const char * | value | ||
) |
Sets an attribute for a node.
node | The node to set an attribute for. |
attr | The name of the attribute. |
value | The value of the attribute. |
void xmlnode_set_attrib_full | ( | xmlnode * | node, |
const char * | attr, | ||
const char * | xmlns, | ||
const char * | prefix, | ||
const char * | value | ||
) |
Sets a namespaced attribute for a node.
node | The node to set an attribute for. |
attr | The name of the attribute to set |
xmlns | The namespace of the attribute to ste |
prefix | The prefix of the attribute to ste |
value | The value of the attribute |
void xmlnode_set_attrib_with_namespace | ( | xmlnode * | node, |
const char * | attr, | ||
const char * | xmlns, | ||
const char * | value | ||
) |
Sets a namespaced attribute for a node.
node | The node to set an attribute for. |
attr | The name of the attribute to set |
xmlns | The namespace of the attribute to ste |
value | The value of the attribute |
void xmlnode_set_attrib_with_prefix | ( | xmlnode * | node, |
const char * | attr, | ||
const char * | prefix, | ||
const char * | value | ||
) |
Sets a prefixed attribute for a node.
node | The node to set an attribute for. |
attr | The name of the attribute to set |
prefix | The prefix of the attribute to ste |
value | The value of the attribute |
void xmlnode_set_namespace | ( | xmlnode * | node, |
const char * | xmlns | ||
) |
Sets the namespace of a node.
node | The node to qualify |
xmlns | The namespace of the node |
void xmlnode_set_prefix | ( | xmlnode * | node, |
const char * | prefix | ||
) |
Sets the prefix of a node.
node | The node to qualify |
prefix | The prefix of the node |
char * xmlnode_to_formatted_str | ( | const xmlnode * | node, |
int * | len | ||
) |
Returns the node in a string of human readable xml.
node | The starting node to output. |
len | Address for the size of the string. |
char * xmlnode_to_str | ( | const xmlnode * | node, |
int * | len | ||
) |
Returns the node in a string of xml.
node | The starting node to output. |
len | Address for the size of the string. |