On Tue, 29 Nov 2011, Graeme Geldenhuys wrote:
On 29/11/2011, [email protected] <michael.vancanneyt@...> wrote:
Graeme, please stop bashing code you personally don't understand.
I guess I deserved that. As for your comment about you never bashing
other peoples code.... What about you bashing EpikTimer every time it
was mentioned of the last 2+ years. Anyway, lets call it even and move
on.
The code works as designed. It is an implementation of a W3 spec.
It passes the W3 test suites, so it is correct code.
I use it in many many projects, and it performs flawlessly.
OK, so in the spirit of education (for myself and others), and with
your fast knowledge of the FPC DOM.... Could you please solve the
original problem of Silvio using the FPC DOM (not the TXMLConfig like
Mattias did).
program test;
{$mode objfpc}{$H+}
uses
Classes,
SysUtils,
DOM,
XMLRead;
var
VXML: TXMLDocument;
N : TDOMNode;
E : TDomELement;
begin
try
ReadXMLFile(VXML, ExtractFilePath(ParamStr(0)) + 'LazSolutionsDT.lpk');
E:=Nil;
// Take first node at 2 levels deep.
N:=VXML.DocumentElement.FirstChild.FirstChild;
While (N<>Nil) and (E=Nil) do
begin
// is it the node we want ?
If (N is TDomElement) and (N.NodeName='Version') then
E:=N as TDomElement;
// Go to next node at the same level.
N:=N.NextSibling;
end;
if Assigned(E) then
// Attributes available as default property of TDomElement.
Writeln('Version ',E['Minor'],' ',E['Release']);
finally
VXML.Free;
end;
end.
Michael.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus