Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

switch_xml.h File Reference


Data Structures

struct  switch_xml
 A representation of an XML tree. More...

Defines

#define SWITCH_XML_BUFSIZE   1024
#define switch_xml_next(xml)   ((xml) ? xml->next : NULL)
 returns the next tag of the same name in the same section and depth or NULL \ if not found
#define switch_xml_name(xml)   ((xml) ? xml->name : NULL)
 returns the name of the given tag
#define switch_xml_txt(xml)   ((xml) ? xml->txt : "")
 returns the given tag's character content or empty string if none
#define switch_xml_new_d(name)   switch_xml_set_flag(switch_xml_new(strdup(name)), SWITCH_XML_NAMEM)
 wrapper for switch_xml_new() that strdup()s name
#define switch_xml_add_child_d(xml, name, off)   switch_xml_set_flag(switch_xml_add_child(xml, strdup(name), off), SWITCH_XML_NAMEM)
 wrapper for switch_xml_add_child() that strdup()s name
#define switch_xml_set_txt_d(xml, txt)   switch_xml_set_flag(switch_xml_set_txt(xml, strdup(txt)), SWITCH_XML_TXTM)
 wrapper for switch_xml_set_txt() that strdup()s txt \ sets the character content for the given tag and returns the tag
#define switch_xml_set_attr_d(xml, name, value)   switch_xml_set_attr(switch_xml_set_flag(xml, SWITCH_XML_DUP), strdup(name), strdup(switch_str_nil(value)))
 Wrapper for switch_xml_set_attr() that strdup()s name/value. Value cannot be NULL.
#define switch_xml_move(xml, dest, off)   switch_xml_insert(switch_xml_cut(xml), dest, off)
 Moves an existing tag to become a subtag of dest at the given offset from \ the start of dest's character content. Returns the moved tag.
#define switch_xml_remove(xml)   switch_xml_free(switch_xml_cut(xml))
 removes a tag along with all its subtags

Enumerations

enum  switch_xml_flag_t { SWITCH_XML_ROOT = (1 << 0), SWITCH_XML_NAMEM = (1 << 1), SWITCH_XML_TXTM = (1 << 2), SWITCH_XML_DUP = (1 << 3) }

Functions

switch_xml_t switch_xml_parse_str (char *s, switch_size_t len)
 Given a string of xml data and its length, parses it and creates an switch_xml \ structure. For efficiency, modifies the data by adding null terminators \ and decoding ampersand sequences. If you don't want this, copy the data and \ pass in the copy. Returns NULL on failure.
switch_xml_t switch_xml_parse_fd (int fd)
 A wrapper for switch_xml_parse_str() that accepts a file descriptor. First \ attempts to mem map the file. Failing that, reads the file into memory. \ Returns NULL on failure.
switch_xml_t switch_xml_parse_file (const char *file)
 a wrapper for switch_xml_parse_fd() that accepts a file name
switch_xml_t switch_xml_parse_file_simple (const char *file)
switch_xml_t switch_xml_parse_fp (FILE *fp)
 Wrapper for switch_xml_parse_str() that accepts a file stream. Reads the entire \ stream into memory and then parses it. For xml files, use switch_xml_parse_file() \ or switch_xml_parse_fd().
switch_xml_t switch_xml_child (switch_xml_t xml, const char *name)
 returns the first child tag (one level deeper) with the given name or NULL \ if not found
switch_xml_t switch_xml_find_child (switch_xml_t node, const char *childname, const char *attrname, const char *value)
 find a child tag in a node called 'childname' with an attribute 'attrname' which equals 'value'
switch_xml_t switch_xml_idx (switch_xml_t xml, int idx)
 Returns the Nth tag with the same name in the same section at the same depth \ or NULL if not found. An index of 0 returns the tag given.
const char * switch_xml_attr (switch_xml_t xml, const char *attr)
 returns the value of the requested tag attribute, or NULL if not found
const char * switch_xml_attr_soft (switch_xml_t xml, const char *attr)
 returns the value of the requested tag attribute, or "" if not found
switch_xml_t switch_xml_get (switch_xml_t xml,...)
 Traverses the switch_xml sturcture to retrieve a specific subtag. Takes a \ variable length list of tag names and indexes. The argument list must be \ terminated by either an index of -1 or an empty string tag name. Example: \ title = switch_xml_get(library, "shelf", 0, "book", 2, "title", -1); \ This retrieves the title of the 3rd book on the 1st shelf of library. \ Returns NULL if not found.
char * switch_xml_toxml (switch_xml_t xml, switch_bool_t prn_header)
 Converts an switch_xml structure back to xml. Returns a string of xml data that \ must be freed.
char * switch_xml_toxml_buf (switch_xml_t xml, char *buf, switch_size_t buflen, switch_size_t offset, switch_bool_t prn_header)
 Converts an switch_xml structure back to xml using the buffer passed in the parameters.
const char ** switch_xml_pi (switch_xml_t xml, const char *target)
 returns a NULL terminated array of processing instructions for the given \ target
void switch_xml_free (switch_xml_t xml)
 frees the memory allocated for an switch_xml structure
const char * switch_xml_error (switch_xml_t xml)
 returns parser error message or empty string if none
switch_xml_t switch_xml_new (const char *name)
 returns a new empty switch_xml structure with the given root tag name
switch_xml_t switch_xml_add_child (switch_xml_t xml, const char *name, switch_size_t off)
 Adds a child tag. off is the offset of the child tag relative to the start \ of the parent tag's character content. Returns the child tag.
switch_xml_t switch_xml_set_txt (switch_xml_t xml, const char *txt)
 sets the character content for the given tag and returns the tag
switch_xml_t switch_xml_set_attr (switch_xml_t xml, const char *name, const char *value)
 Sets the given tag attribute or adds a new attribute if not found. A value \ of NULL will remove the specified attribute.
switch_xml_t switch_xml_set_flag (switch_xml_t xml, switch_xml_flag_t flag)
 sets a flag for the given tag and returns the tag
switch_xml_t switch_xml_cut (switch_xml_t xml)
 removes a tag along with its subtags without freeing its memory
switch_xml_t switch_xml_insert (switch_xml_t xml, switch_xml_t dest, switch_size_t off)
 inserts an existing tag into an ezxml structure
switch_xml_t switch_xml_open_root (uint8_t reload, const char **err)
 open the Core xml root
switch_status_t switch_xml_init (switch_memory_pool_t *pool, const char **err)
 initilize the core XML backend
switch_status_t switch_xml_destroy (void)
switch_xml_t switch_xml_root (void)
 retrieve the core XML root node
switch_status_t switch_xml_locate (const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_xml_t *root, switch_xml_t *node, switch_event_t *params)
 locate an xml pointer in the core registry
switch_status_t switch_xml_locate_domain (const char *domain_name, switch_event_t *params, switch_xml_t *root, switch_xml_t *domain)
switch_status_t switch_xml_locate_user (const char *key, const char *user_name, const char *domain_name, const char *ip, switch_xml_t *root, switch_xml_t *domain, switch_xml_t *user, switch_event_t *params)
switch_xml_t switch_xml_open_cfg (const char *file_path, switch_xml_t *node, switch_event_t *params)
 open a config in the core registry
switch_status_t switch_xml_bind_search_function (switch_xml_search_function_t function, switch_xml_section_t sections, void *user_data)
 bind a search function to an external gateway
switch_xml_section_t switch_xml_parse_section_string (const char *str)
 parse a string for a list of sections


Generated on Mon May 26 22:06:53 2008 for FreeSWITCH by  doxygen 1.3.9.1