コード例 #1
0
ファイル: plist.c プロジェクト: amosbird/ctags
static xmlNode *getPrevKeyElement (xmlNode *node)
{
	xmlNode *prev;

	prev = xmlPreviousElementSibling (node);
	if (prev)
	{
		if (strcmp ((char *)prev->name, "key") == 0)
			return prev;
		else
			prev = NULL;
	}
	return prev;
}
コード例 #2
0
static xmlNodePtr xmlPreviousElementSiblingN(xmlNodePtr node) {

	g_return_val_if_fail(node != NULL, NULL);

	xmlNodePtr record = NULL; // = node->prev;
	
	switch(node->type)
	{
	case XML_ELEMENT_NODE:
		record = node->prev;

		while(xmlIsBlankNode(record)==1)
			record = record->prev;
						
		if(record == NULL) {
			record = xmlGetParentNode(node);
			record = record->properties;
			if(record != NULL) {
				while(record->next != NULL)
					record = record->next;
			}
		}
		
		break;
		
	case XML_TEXT_NODE:
		while(xmlIsBlankNode(record)==1)
			record = record->prev;
		break;
	case XML_ATTRIBUTE_NODE:
		record = node->prev;
		break;
	case XML_DOCUMENT_NODE:
	case XML_HTML_DOCUMENT_NODE:
		record = NULL;
		break;
	default:
		record = xmlPreviousElementSibling(node);
		break;
	}
		
	return record;
}