Im trying to make a little applikation that reads something out of a XML-File. I dont know much about it and tried the first example at
http://wiki.lazarus.freepascal.org/XML_Tutorial to learn, but it doesn't work. I get this errormessage:
In 'file:///L:/Programmieren/Lazarus/XML/2.XML'(line1 pos 4): XML declaration is not allowed here.
Press OK to ignore and risk data corruption.
Press Cancel to kill program.
Code:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, DOM, XMLRead, XMLWrite;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var
PassNode: TDOMNode;
Doc: TXMLDocument;
begin
ReadXMLFile(Doc, 'L:\Programmieren\Lazarus\XML\2.XML');
PassNode := Doc.DocumentElement.FindNode('password');
WriteLn(PassNode.FirstChild.NodeValue);
end;
initialization
{$I unit1.lrs}
end.
XML File:
<?xml version="1.0"?>
<request>
<request_type>PUT_FILE</request_type>
<username>123</username>
<password>abc</password>
</request>
Like you see its nearly the same as in the wiki, but it doesn't work...

Can u help me?
Thanks!!
