diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-13 23:05:13 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-13 23:05:13 +0100 | 
| commit | 3429b589177f286384dab151c167e16071f8a828 (patch) | |
| tree | 756963dee5779aa0e54109701669bd69b97d0bb8 /lib/xmltree.c | |
| parent | 58f5ef70c3824b881ad6b35f854a8c8ac59a5d32 (diff) | |
| parent | 3742fb6ae99c2e5e25cff272a154b9834866e8f9 (diff) | |
Mainline merge.
Diffstat (limited to 'lib/xmltree.c')
| -rw-r--r-- | lib/xmltree.c | 22 | 
1 files changed, 21 insertions, 1 deletions
| diff --git a/lib/xmltree.c b/lib/xmltree.c index 67fe46e1..31f8ee9c 100644 --- a/lib/xmltree.c +++ b/lib/xmltree.c @@ -448,7 +448,11 @@ struct xt_node *xt_find_node( struct xt_node *node, const char *name )  {  	while( node )  	{ -		if( g_strcasecmp( node->name, name ) == 0 ) +		char *colon; +		 +		if( g_strcasecmp( node->name, name ) == 0 || +		    ( ( colon = strchr( node->name, ':' ) ) && +		      g_strcasecmp( colon + 1, name ) == 0 ) )  			break;  		node = node->next; @@ -460,6 +464,7 @@ struct xt_node *xt_find_node( struct xt_node *node, const char *name )  char *xt_find_attr( struct xt_node *node, const char *key )  {  	int i; +	char *colon;  	if( !node )  		return NULL; @@ -468,6 +473,21 @@ char *xt_find_attr( struct xt_node *node, const char *key )  		if( g_strcasecmp( node->attr[i].key, key ) == 0 )  			break; +	/* This is an awful hack that only takes care of namespace prefixes +	   inside a tag. Since IMHO excessive namespace usage in XMPP is +	   massive overkill anyway (this code exists for almost four years +	   now and never really missed it): Meh. */ +	if( !node->attr[i].key && strcmp( key, "xmlns" ) == 0 && +	    ( colon = strchr( node->name, ':' ) ) ) +	{ +		*colon = '\0'; +		for( i = 0; node->attr[i].key; i ++ ) +			if( strncmp( node->attr[i].key, "xmlns:", 6 ) == 0 && +			    strcmp( node->attr[i].key + 6, node->name ) == 0 ) +				break; +		*colon = ':'; +	} +	  	return node->attr[i].value;  } | 
