Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/AddressHistory.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by hi_, Sat Aug 9 13:50:39 2003 UTC revision 1.2 by yoffy, Sat Aug 9 14:22:48 2003 UTC
# Line 4  interface Line 4  interface
4    
5  uses  uses
6          SysUtils, Classes, {SAX, SAXHelpers, SAXComps, SAXKW,}          SysUtils, Classes, {SAX, SAXHelpers, SAXComps, SAXKW,}
7          GikoSystem, XMLIntf, XMLDoc{, HttpApp};          GikoSystem, {XMLIntf, XMLDoc}{, HttpApp} YofUtils;
8    
9  type  type
10          TAddressHistoryDM = class(TDataModule)          TAddressHistoryDM = class(TDataModule)
# Line 40  begin Line 40  begin
40  end;  end;
41    
42  procedure TAddressHistoryDM.ReadHistory(sl: TStrings; ReadCount: Integer);  procedure TAddressHistoryDM.ReadHistory(sl: TStrings; ReadCount: Integer);
43    {
44  var  var
45          FileName: string;          FileName: string;
46          XMLDoc: IXMLDocument;          XMLDoc: IXMLDocument;
# Line 47  var Line 48  var
48          HistoryNode: IXMLNode;          HistoryNode: IXMLNode;
49          i: Integer;          i: Integer;
50          s: string;          s: string;
51    }
52  begin  begin
53    {
54          sl.Clear;          sl.Clear;
55          FReadCount := ReadCount;          FReadCount := ReadCount;
56    
57          FileName := GikoSys.GetConfigDir + ADDRESS_HISTORY_FILE_NAME;          FileName := GikoSys.GetConfigDir + ADDRESS_HISTORY_FILE_NAME;
58    
59          if FileExists(FileName) then begin          if FileExists(FileName) then begin
60                  XMLDoc := LoadXMLDocument(FileName);                  try
61                  XMLNode := XMLDoc.DocumentElement;                          XMLDoc := LoadXMLDocument(FileName);
62                            XMLNode := XMLDoc.DocumentElement;
63                  if XMLNode.NodeName = 'address' then begin  
64                          for i := 0 to XMLNode.ChildNodes.Count - 1 do begin                          if XMLNode.NodeName = 'address' then begin
65                                  HistoryNode := XMLNode.ChildNodes[i];                                  for i := 0 to XMLNode.ChildNodes.Count - 1 do begin
66                                  if HistoryNode.NodeName = 'history' then begin                                          HistoryNode := XMLNode.ChildNodes[i];
67                                          if FReadCount >= sl.Count then begin                                          if HistoryNode.NodeName = 'history' then begin
68                                                  s := Trim(HistoryNode.Attributes['url']);                                                  if FReadCount >= sl.Count then begin
69                                                  if s <> '' then                                                          s := Trim(HistoryNode.Attributes['url']);
70                                                          sl.Add(s);                                                          if s <> '' then
71                                                          //sl.Add(HttpDecode(s));                                                                  sl.Add(s);
72                                                                    //sl.Add(HttpDecode(s));
73                                                    end;
74                                          end;                                          end;
75                                  end;                                  end;
76                          end;                          end;
77                    except
78                  end;                  end;
79          end;          end;
80    }
81  //      AddressSAXHandler.OnStartDocument := SAXStartDocument;  //      AddressSAXHandler.OnStartDocument := SAXStartDocument;
82  //      AddressSAXHandler.OnEndDocument := SAXEndDocument;  //      AddressSAXHandler.OnEndDocument := SAXEndDocument;
83  //      AddressSAXHandler.OnStartElement := SAXStartElement;  //      AddressSAXHandler.OnStartElement := SAXStartElement;
# Line 87  end; Line 93  end;
93  procedure TAddressHistoryDM.WriteHistory(sl: TStrings; WriteCount: Integer);  procedure TAddressHistoryDM.WriteHistory(sl: TStrings; WriteCount: Integer);
94  var  var
95          FileName: string;          FileName: string;
96  //      SaveList: TStringList;          SaveList: TStringList;
97          i: Integer;          i: Integer;
98          Count: Integer;          Count: Integer;
99    {
100          XMLDoc: IXMLDocument;          XMLDoc: IXMLDocument;
101          XMLNode: IXMLNode;          XMLNode: IXMLNode;
102          HistoryNode: IXMLNode;          HistoryNode: IXMLNode;
103    }
104  begin  begin
105    {
106          XMLDoc :=  NewXMLDocument;          XMLDoc :=  NewXMLDocument;
107          XMLDoc.Encoding := 'Shift_JIS';          XMLDoc.Encoding := 'Shift_JIS';
108          XMLDoc.StandAlone := 'yes';          XMLDoc.StandAlone := 'yes';
# Line 111  begin Line 119  begin
119                  HistoryNode.Attributes['url'] := Trim(sl[i]);                  HistoryNode.Attributes['url'] := Trim(sl[i]);
120          end;          end;
121          XMLDoc.SaveToFile(FileName);          XMLDoc.SaveToFile(FileName);
122    }
123  {       FileName := GikoSys.GetConfigDir + ADDRESS_HISTORY_FILE_NAME;          FileName := GikoSys.GetConfigDir + ADDRESS_HISTORY_FILE_NAME;
124          SaveList := TStringList.Create;          SaveList := TStringList.Create;
125          try          try
126                  if sl.Count > WriteCount then                  if sl.Count > WriteCount then
# Line 128  begin Line 136  begin
136                  SaveList.SaveToFile(FileName);                  SaveList.SaveToFile(FileName);
137          finally          finally
138                  SaveList.Free;                  SaveList.Free;
139          end;}          end;
140  end;  end;
141    
142  {procedure TAddressHistoryDM.SAXStartDocument(Sender: TObject);  {procedure TAddressHistoryDM.SAXStartDocument(Sender: TObject);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26