Return TypeFunction nameArguments
hzXmlNode*hzXmlNode::FindSubnode(const char*,)

Declared in file: hzDocument.h
Defined in file : hzDocXml.cpp

Function Logic:

0:START 1:cpBuf strchr x 2:x 3:i j 4:*i&&*i!=(char)46; 5:* 6:* tagname hzXmlNode::_findsubnode pResult cpBuf 7:pResult&&bMatch 8:Return pResult->FindSubnode(x+1) 9:Return 0 10:i j 11:*i; 12:*i==(char)61||(*i=='-'&&i[1]=='>') 13:* 14:* j tagname 15:i[0]=='-'&&i[1]=='>' 16:*i; 17:*i==(char)61 18:* 19:* j attrname 20:*i==(char)61 21:*i&&*i!=(char)39; 22:*i; 23:*i==(char)39 24:* 25:* value 26:cpBuf hzXmlNode::_findsubnode pResult 27:pResult&&bMatch 28:Return pResult 29:Return 0

Function body:

hzXmlNode* hzXmlNode::FindSubnode (const char* srchExp)
{
   hzXmlNode*  pResult ;
   char*       cpBuf ;
   const char* i ;
   const char* x ;
   char*       j ;
   hzString    tagname ;
   hzString    attrname ;
   hzString    value ;
   bool        bMatch ;
   /*
   **  ** Create a temp buffer
   **      */
   cpBuf = new char[strlen(srchExp) + 1];
   /*
   **  ** We first check for criteria of the form tagname.tagname .....
   **   ** If we do have this we have to recurse this function
   **      */
   x = strchr(srchExp, CHAR_PERIOD) ;
   if (x)
   {
       i = srchExp ;
       j = cpBuf ;
       for (; *i && *i != CHAR_PERIOD ;)
           *j++ = *i++ ;
       *j = 0;
       tagname = cpBuf ;
       pResult = _findsubnode(bMatch, tagname, attrname, value) ;
       delete cpBuf ;
       if (pResult && bMatch)
           return pResult->FindSubnode(x + 1);
       return 0;
   }
   /*
   **  ** Objain the tagname, any attribute name and value from the criteria
   **      */
   i = srchExp ;
   j = cpBuf ;
   for (; *i ; i++)
   {
       if (*i == CHAR_EQUAL || (*i == ''-''&&i[1]== ''>''))
           break ;
       *j++ = *i ;
   }
   *j = 0;
   tagname = j = cpBuf ;
   if (i[0]== ''-''&&i[1]== ''>'')
   {
       for (i += 2; *i ; i++)
       {
           if (*i == CHAR_EQUAL)
               break ;
           *j++ = *i ;
       }
       *j = 0;
       attrname = j = cpBuf ;
   }
   if (*i == CHAR_EQUAL)
   {
       for (i++ ; *i && *i != CHAR_SQUOTE ; i++) ;
       for (i++ ; *i ; i++)
       {
           if (*i == CHAR_SQUOTE)
               break ;
           *j++ = *i ;
       }
       *j = 0;
       value = cpBuf ;
   }
   delete cpBuf ;
   /*
   **  ** Find the subnode by recursive search
   **      */
   pResult = _findsubnode(bMatch, tagname, attrname, value) ;
   if (pResult && bMatch)
       return pResult ;
   return 0;
}