Lazarus Reading XML- with TXMLDocument and TDOMNode

这里读取'HistoryPath' ,'TracePath' 元素下的‘value’属性使用的是

  1. var  
  2.   xmlCfg: TXMLDocument;   
  3.   
  4. ....   
  5.        
  6. function ReadXMLCFG: boolean;   
  7. var  
  8. .....   
  9.   HistoryPath: string = '';   
  10.   TracePath: string = '';   
  11.   vChild: TDOMNode;   
  12. .....   
  13. begin  
  14.   Result := False;   
  15.   if ... then  
  16.   begin  
  17.      .....   
  18.       ReadXMLFile(xmlCfg, vCMSConfigXml);   
  19.       vChild := xmlCfg.DocumentElement.FirstChild;   
  20.       while Assigned(vChild) do  
  21.       begin  
  22.         if vChild.HasAttributes then  
  23.         begin  
  24.           eName := vChild.NodeName;   
  25.           if eName = 'HistoryPath' then  
  26.           begin  
  27.             HistoryPath := vChild.Attributes.GetNamedItem('value').NodeValue;   
  28.           end;   
  29.           if eName = 'TracePath' then  
  30.           begin  
  31.             TracePath := vChild.Attributes.GetNamedItem('value').NodeValue;   
  32.           end;   
  33.         end;   
  34.         vChild := vChild.NextSibling;   
  35.       end;   
  36.    .....   
  37.     end;   
  38.   end;   
  39. end;  

原文地址:https://www.cnblogs.com/hieroly/p/5201558.html