예제 #1
0
파일: bonjour_ft.c 프로젝트: dylex/pidgin
/**
 * Frees the whole tree of an xml node
 *
 * First determines the root of the xml tree and then frees the whole tree
 * from there.
 *
 * @param node	The node to free the tree from
 */
static void
xmlnode_free_tree(xmlnode *node)
{
	g_return_if_fail(node != NULL);

	while(xmlnode_get_parent(node))
		node = xmlnode_get_parent(node);

	xmlnode_free(node);
}
예제 #2
0
파일: xdb_utils.c 프로젝트: Doap/transports
void xdb_file_endElement(void* arg, const char* name)
{
    xf_parse xfp = (xf_parse)arg;
	register xmlnode current = xmlnode_get_parent(xfp->current);

    xfp->current->complete = 1;

	if (current != NULL)
	  xfp->current = current;
}
예제 #3
0
void expat_endElement(void* userdata, const char* name)
{
    xmlnode *x = userdata;
    xmlnode current = *x;

    current->complete = 1;
    current = xmlnode_get_parent(current);

    /* if it's NULL we've hit the top folks, otherwise back up a level */
    if(current != NULL)
        *x = current;
}
예제 #4
0
파일: xmlnode.c 프로젝트: bcy/muc
static spool _xmlnode2spool(xmlnode node)
{
    spool s;
    int level=0,dir=0;
    xmlnode tmp;

    if(!node || xmlnode_get_type(node)!=NTYPE_TAG)
        return NULL;

    s = spool_new(xmlnode_pool(node));
    if(!s) return(NULL);

    while(1)
    {
        if(dir==0)
        {
    	    if(xmlnode_get_type(node) == NTYPE_TAG)
            {
                if(xmlnode_has_children(node))
                {
                    _xmlnode_tag2str(s,node,1);
                    node = xmlnode_get_firstchild(node);
                    level++;
                    continue;
                }else{
                    _xmlnode_tag2str(s,node,0);
                }
            }else{
                spool_add(s,strescape(xmlnode_pool(node),xmlnode_get_data(node)));
            }
        }

    	tmp = xmlnode_get_nextsibling(node);
        if(!tmp)
        {
            node = xmlnode_get_parent(node);
            level--;
            if(level>=0) _xmlnode_tag2str(s,node,2);
            if(level<1) break;
            dir = 1;
        }else{
            node = tmp;
            dir = 0;
        }
    }

    return s;
}