Пример #1
0
char *XMLTreeNode::GetAttributeValue(const char *name) const
{
	XMLAttribute *a;

	a=GetAttribute(name);
	if (a) return a->GetValue();

	return 0;
}
void ConfigParser::locateElement()
{
   if (pParent != 0)
   {
      for (int i=0; i<pParent->pElement->GetChildrenCount(); i++)
      {
         XMLElement *pElem = pParent->pElement->GetChild(i);
         if (pElem->GetName().Equals(sElemName))
         {
            if (lID == -1)
            {
               pElement = pElem;
               return;
            }
            else
            {
               XMLAttribute *pAttr = pElem->FindAttribute("id");
               if (pAttr)
               {
                  if (pAttr->GetValue().ToLong() == lID)
                  {
                     pElement = pElem;
                     return;
                  }
               }
            }
         }
      }
      
      pElement = pParent->addChild(sElemName);
      if (-1 != lID)
      {
         pElement->AddAttribute("id", lID);
      }
   }
}