Autor Beitrag
Jailbird
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 127

Windows XP Pro SP2
Delphi 7 Professional
BeitragVerfasst: Mi 23.03.05 17:51 
Moin

Hab mal 'nen seltsames Problem. Ich möchte ein XML Laden und halt in meine Datenstruktur laden. Ich hab das Einlesen mal vereinfacht, weil sogar so früh schon ein Fehler auftritt.

Anbei der Code

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure TTurnier.LoadFromFile(const LFileName: String);
var
  xml: IXMLDocument;
  k: integer;
begin
  xml := NewXMLDocument('1.0');
  with xml do
  begin
    Encoding := 'iso-8859-1';
    NodeIndentStr := #9;
    Options := [doNodeAutoCreate, doNodeAutoIndent, doAttrNull, doAutoPrefix, doNamespaceDecl];
    LoadFromFile(LFileName);
    Active := True;
    with DocumentElement do
    begin
      for k := 0 to ChildNodes.Count - 1 do
      begin
        ShowMessage(ChildValues[k]);  // <-- Access Violation hier (auch bei ChildNodes[k].NodeValue)
      end;     
    end;
  end;
  xml := nil;
end;


Und hier ein Auszug aus dem XML

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
<?xml version="1.0" encoding="iso-8859-1"?>
<Turnier>
  <K1>
    <Gruppen>
      <Gruppe>
        <Nummer>1</Nummer>
      </Gruppe>
      <Gruppe>
        <Nummer>2</Nummer>
      </Gruppe>
      <Gruppe>
        <Nummer>3</Nummer>
      </Gruppe>
      <Gruppe>
        <Nummer>4</Nummer>
      </Gruppe>
    </Gruppen>
  </K1>
  <K2>
    <Gruppen>
      <Gruppe>
        <Nummer>5</Nummer>
      </Gruppe>
      <Gruppe>
        <Nummer>6</Nummer>
      </Gruppe>
    </Gruppen>
  </K2>
  <K3>
    <Gruppen>
      <Gruppe>
        <Nummer>7</Nummer>
      </Gruppe>
    </Gruppen>
  </K3>
</Turnier>


Vielen Dank für jede Hilfe
Jailbird
Jailbird Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 127

Windows XP Pro SP2
Delphi 7 Professional
BeitragVerfasst: Mi 23.03.05 18:14 
Frage hat sich erledigt