finished parsing svn info xml

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@89 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
vsnijders
2007-02-26 23:36:16 +00:00
parent f62ba9ec2d
commit e66f989df8
4 changed files with 109 additions and 57 deletions

View File

@ -19,6 +19,7 @@ type
FAuthor: string;
FDate: string;
FRevision: integer;
procedure LoadFromNode(ANode: TDomNode);
public
procedure Clear;
property Author: string read FAuthor write FAuthor;
@ -30,11 +31,12 @@ type
TRepository = class
private
FUrl: string;
FRoot: string;
FUUID: string;
procedure LoadFromNode(ANode: TDomNode);
public
procedure Clear;
property URL: string read FUrl write FUrl;
property Root: string read FRoot write FRoot;
property UUID: string read FUUID write FUUID;
end;
@ -151,6 +153,9 @@ begin
UrlNode := EntryNode.FindNode('url');
if assigned(UrlNode) then
FUrl := UrlNode.TextContent;
FRepository.LoadFromNode(EntryNode.FindNode('repository'));
FCommit.LoadFromNode(EntryNode.FindNode('commit'));
end;
end;
@ -180,14 +185,51 @@ end;
{ TRepository }
procedure TRepository.LoadFromNode(ANode: TDomNode);
var
RepositoryNode: TDomElement;
ChildNode: TDOMNode;
begin
if ANode=nil then exit;
if ANode.NodeType = ELEMENT_NODE then begin
RepositoryNode := TDomElement(ANode);
ChildNode := RepositoryNode.FindNode('root');
if assigned(ChildNode) then
FRoot := ChildNode.TextContent;
ChildNode := RepositoryNode.FindNode('uuid');
if assigned(ChildNode) then
FUUID := ChildNode.TextContent;
end;
end;
procedure TRepository.Clear;
begin
FUrl := '';
FRoot := '';
FUUID := '';
end;
{ TCommit }
procedure TCommit.LoadFromNode(ANode: TDomNode);
var
CommitNode: TDomElement;
ChildNode: TDOMNode;
begin
if ANode=nil then exit;
if ANode.NodeType = ELEMENT_NODE then begin
CommitNode := TDomElement(ANode);
FRevision := StrToIntDef(CommitNode.GetAttribute('revision'),0);
ChildNode := CommitNode.FindNode('author');
if assigned(ChildNode) then
FAuthor := ChildNode.TextContent;
ChildNode := CommitNode.FindNode('date');
if assigned(ChildNode) then
FDate := ChildNode.TextContent;
end;
end;
procedure TCommit.Clear;
begin
FAuthor := '';