I have the following program which very nearly works but is producing the following error when I try and compile, I have no idea how to fix it! any ideas?
Forms, mainform in 'mainform.pas'...
"unit1.pas(9): , or ; expected but 'IN' found; "project1 could not compile unit1.pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Dialogs, LibXmlParser, LibXmlComps, StdCtrls,
Forms,
mainform in 'mainform.pas'
mapimail in 'mapimail.pas';
type
TXMLRule = Record
alert, desc, act:string;
end;
TForm1 = class(TForm)
Button1: TButton;
EasyXmlScanner1: TEasyXmlScanner;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Parser : TXmlParser;
MyXMLRules:Array[1..10] of TXMLRule;
i :1..10;
implementation
{$R *.dfm}
procedure ProcessXML();
begin
Parser := TXmlParser.Create;
Parser.Normalize := TRUE;
Parser.LoadFromFile ('c:\parser.xml');
Parser.StartScan;
while Parser.Scan do
case Parser.CurPartType of
ptStartTag,
ptEmptyTag :
begin
end;
ptContent :
begin
if Parser.CurName = ('<alert>') then MyXMLRules[1].alert := Parser.CurContent;
if Parser.CurName = ('<desc>') then MyXMLRules[1].desc := Parser.CurContent;
if Parser.CurName = ('<action>') then MyXMLRules[1].act := Parser.Curcontent;
end;
end;
Parser.Free;
end;
procedure EmailAlert();
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end;
procedure NoiseAlert();
begin
end;
procedure TForm1.Button1Click(Sender: TObject);
var
f:textFile;
data:string;
begin
ProcessXML();
AssignFile(f, 'c:\nmap.txt');
reset(f);
repeat
readln(f, data);
if (pos(MyXMLRules[1].alert, data)) <> 0 then
begin
if MyXMLRules[1].act
= ('Email') then
begin
EmailAlert
end;
if MyXMLRules[1].act
= ('Beep') then
begin
NoiseAlert
end;
end;
until EOF(f);
end;
end.