示例#1
0
文件: sdtid.c 项目: zbuc/stoken
static xmlNode *find_child_named(xmlNode *node, const char *name)
{
	for (; ; node = node->next) {
		if (!node)
			break;
		if (xmlnode_is_named(node, name))
			return node;
	}
	return NULL;
}
示例#2
0
文件: sdtid.c 项目: MufriA/stoken
static char *__lookup_common(struct sdtid *s, xmlNode *node, const char *name)
{
	if (s->error != ERR_NONE || !node)
		return NULL;

	for (node = node->children; node; node = node->next) {
		char *val = __lookup_common(s, node, name);
		if (val)
			return val;
		if (xmlnode_is_named(node, name)) {
			val = (char *)xmlNodeGetContent(node);
			if (!val)
				s->error = ERR_NO_MEMORY;
			return val;
		}
	}
	return NULL;
}
示例#3
0
文件: sdtid.c 项目: zbuc/stoken
static int __replace_string(struct sdtid *s, xmlNode *node,
			    const char *name, const char *value)
{
	int ret;

	for (node = node->children; node; node = node->next) {
		ret = __replace_string(s, node, name, value);
		if (ret != ERR_GENERAL)
			return ret;
		if (xmlnode_is_named(node, name)) {
			xmlChar *input = xmlEncodeEntitiesReentrant(s->doc,
								    value);
			if (!input)
				return ERR_NO_MEMORY;
			xmlNodeSetContent(node, input);
			free(input);
			return ERR_NONE;
		}
	}
	return ERR_GENERAL;
}