Autor Beitrag
peicher
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16

Windows XP, Windows 2K, Suse Linux 8.2
Borland Delphi 7
BeitragVerfasst: Mo 29.09.03 08:57 
Hallo!

Hab folgendes Problem: Ich will mit hilfe von TXMLDocument eine neue XML-Datei erstellen, nur bekomme ich immer einen Speicher-Zugriffsfehler.

Mein Code dazu:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
XmlDocSave.Active := true;
    XmlDocSave.IsEmptyDoc;

    node := XmlDocSave.DocumentElement.AddChild('Test');
    node.Attributes['hallo'] := 'TestAttribut';

    node2 := node.AddChild('nummer1');
    node2.Text := 'Text zu Nummer1';

    XmlDocSave.SaveToXml(str);


Der Fehler kommt bei der Zeile
ausblenden Delphi-Quelltext
1:
node := XmlDocSave.DocumentElement.AddChild('Test');					

Meiner Meinung müsste ja alles passen aber der Compiler denkt da wieder mal anders :wink:

Ich hoffe, dass mir da jemand weiterhelfen kann.. :think:

MfG

_________________
-PHIL-
HawkLUED
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 62

WinXP
Delphi 7 Enterprise, Delphi 2007
BeitragVerfasst: Mi 01.10.03 13:19 
Titel: Wo ist Dein DocumentElement?
Hi,

jetzt mal so ganz spontan! Du deklarierst dein Dokument als "isEmptyDoc"! Und sagst dann Document.AddChild, aber zu welchem DocumentElement soll er ein Kind erzeugen??

Gruß

Andreas