示例#1
0
XMLAttribute *XMLTreeNode::GetAttribute(const char *name) const
{
	XMLAttribute *a;

	a=attributes;

	while (a)
	{
		if (a->GetName())
		{
			switch (mmode)
			{
			case MATCH_CASE:
				if (!strcmp(a->GetName(), name)) return a;

			case MATCH_NOCASE:
				if (!stricmp(a->GetName(), name)) return a;
			}
		}

		a=a->GetNext();
	}

	return 0;
}
示例#2
0
void XMLTreeNode::SetAttribute(char *name, char *value)
{
	XMLAttribute *a;

	a=GetAttribute(name);

	if (a)
		a->SetValue(value);
	else
	{
		a=attributes;

		if (a)
		{
			while (a->GetNext()) a=a->GetNext();

			a->SetNext(new XMLAttribute(a, name, value, 0));
		}
		else
		{
			a=attributes=new XMLAttribute(0, name, value, 0);
		}
	}
}