Using a supplied starting node (arg 1) to define a sub-tree of the current document's tree of XML nodes (tags), obtain the set of nodes whose name matches the supplied node-name (arg 2). Then, depending on the value of the supplied control string (arg 3), build the string to be returned by value, as one of the following:- 1) Info="aggr". Aggregate the content of all the matching nodes. 2) Info="node". Take the content from the first matching node. 3) Other value. Take this value as the attribute name. The result will then be the attribute value (if found) of the first matching node.

Return TypeFunction nameArguments
hzStringhzDocXml::GetValue(hzXmlNode*,hzString&,hzString&,)

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

Function Logic:

0:START 1:unknown 2:Return S 3:items 4:unknown 5:Return S 6:pN 7:unknown 8:unknown 9:pN items 10:S 11:Info==node 12:S 13:unknown 14:unknown 15:anam 16:unknown 17:S 18:Return S

Function body:

hzString hzDocXml::GetValue (hzXmlNode* pRoot)hzString& Nodename, hzString& Info, 
{
   //  Using a supplied starting node (arg 1) to define a sub-tree of the current document's tree of XML nodes (tags), obtain the set of nodes
   //  whose name matches the supplied node-name (arg 2). Then, depending on the value of the supplied control string (arg 3), build the string
   //  to be returned by value, as one of the following:-
   //  
   //  1) Info="aggr". Aggregate the content of all the matching nodes.
   //  2) Info="node". Take the content from the first matching node.
   //  3) Other value. Take this value as the attribute name. The result will then be the attribute value (if found) of the first matching
   //       node.
   //  
   //  Arguments: 1) pRoot  Starting node
   //     2) Nodename Name nodes must have to be processed
   //     3) Info  Processing directive
   //  
   //  Returns: Instance of hzString by value containing the requested sub-tree
   hzVect<hzXmlNode*>  nodelist ;  //  List of subnodes of (node supplied in arg 1) matching m_Slct
   hzChain         X ;             //  For aggregating content from a series of like nodes
   hzAttrset       ai ;            //  Attribute iterator
   hzXmlNode*      pN ;            //  Node pointer
   const char*     anam ;          //  Attribute value
   hzString        S ;             //  Output value (tag value garnered)
   uint32_t        nIndex ;        //  Iterator for nodelist
   if (!pRoot)
       return S ;
   pRoot->FindSubnodes(nodelist, *Nodename) ;
   if (!nodelist.Count())
       return S ;
   pN = nodelist[0];
   if (Info == "aggr")
   {
       //  We need a series of nodes meeting the criteria defined in m_Slct, not just a single node
       for (nIndex = 0; nIndex < nodelist.Count() ; nIndex++)
       {
           pN = nodelist[nIndex] ;
           X << pN->m_fixContent ;
       }
       S = X ;
   }
   else if (Info == "node")
       S = pN->m_fixContent ;
   else
   {
       if (memcmp(*Info, "->", 2)== 0)
       {
           for (ai = pN ; ai.Valid() ; ai.Advance())
           {
               anam = ai.Name() ;
               if (!strcmp(anam, *Info + 2))
               {
                   S = ai.Value() ;
                   break ;
               }
           }
       }
   }
   return S ;
}