Esempio n. 1
0
	__declspec(dllexport) void* ILibWrapper_ParseStringAdv(char* buffer, int offset, int length, const char* Delimiter, int DelimiterLength)
	{
		return(ILibParseStringAdv(buffer, offset, length, Delimiter, DelimiterLength));
	}
struct ILibXMLAttribute *ILibGetXMLAttributes(struct ILibXMLNode *node)
{
	struct ILibXMLAttribute *RetVal = NULL;
	struct ILibXMLAttribute *current = NULL;
	char *c;
	int EndReserved = (node->EmptyTag==0)?1:2;
	
	struct parser_result *xml;
	struct parser_result_field *field;
	struct parser_result *temp2;
	struct parser_result *temp3;
	
	c = (char*)node->Reserved - 1;
	while(*c!='<')
	{
		c = c -1;
	}
	c = c +1;
	
	xml = ILibParseStringAdv(c,0,(int)((char*)node->Reserved - c -EndReserved)," ",1);
	field = xml->FirstResult;
	if(field!=NULL) {field = field->NextResult;}
	while(field!=NULL)
	{
		if(RetVal==NULL)
		{
			RetVal = (struct ILibXMLAttribute*)MALLOC(sizeof(struct ILibXMLAttribute));
			RetVal->Next = NULL;
		}
		else
		{
			current = (struct ILibXMLAttribute*)MALLOC(sizeof(struct ILibXMLAttribute));
			current->Next = RetVal;
			RetVal = current;
		}
		temp2 = ILibParseStringAdv(field->data,0,field->datalength,":",1);
		if(temp2->NumResults==1)
		{
			RetVal->Prefix = NULL;
			RetVal->PrefixLength = 0;
			temp3 = ILibParseStringAdv(field->data,0,field->datalength,"=",1);
		}
		else
		{
			RetVal->Prefix = temp2->FirstResult->data;
			RetVal->PrefixLength = temp2->FirstResult->datalength;
			temp3 = ILibParseStringAdv(field->data,RetVal->PrefixLength+1,field->datalength-RetVal->PrefixLength-1,"=",1);
		}
		ILibDestructParserResults(temp2);
		RetVal->Name = temp3->FirstResult->data;
		RetVal->NameLength = temp3->FirstResult->datalength;
		RetVal->Value = temp3->LastResult->data;
		RetVal->ValueLength = temp3->LastResult->datalength;
		ILibDestructParserResults(temp3);
		field = field->NextResult;
	}
	
	ILibDestructParserResults(xml);
	return(RetVal);
	
}