Lazarus Reading XML- with TXMLDocument and TDOMNode
这里读取'HistoryPath' ,'TracePath' 元素下的‘value’属性使用的是
- var
- xmlCfg: TXMLDocument;
- ....
- function ReadXMLCFG: boolean;
- var
- .....
- HistoryPath: string = '';
- TracePath: string = '';
- vChild: TDOMNode;
- .....
- begin
- Result := False;
- if ... then
- begin
- .....
- ReadXMLFile(xmlCfg, vCMSConfigXml);
- vChild := xmlCfg.DocumentElement.FirstChild;
- while Assigned(vChild) do
- begin
- if vChild.HasAttributes then
- begin
- eName := vChild.NodeName;
- if eName = 'HistoryPath' then
- begin
- HistoryPath := vChild.Attributes.GetNamedItem('value').NodeValue;
- end;
- if eName = 'TracePath' then
- begin
- TracePath := vChild.Attributes.GetNamedItem('value').NodeValue;
- end;
- end;
- vChild := vChild.NextSibling;
- end;
- .....
- end;
- end;
- end;