Autor Beitrag
N1m3
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 30


Borland Delphi 2005 Personal
BeitragVerfasst: Mo 23.06.08 16:42 
Hallo zusammen

Ich wollte eine XML Datei einlesen, jetzt habe ich eine Include Datei gefunden die 'MSXML2_TLB.pas'.
Dazu dann folgendes Tutorial www.techvanguards.co...msxml/hellomsxml.asp

Aber ich bringe es trotzdem nicht zum laufen.

ausblenden volle Höhe 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:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, MSXML2_TLB, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
    doc: IXMLDOMDocument;
    MessageText: string;
begin
    //create DOM document instance
    doc := CoDOMDocument.Create;

    //prepare to load an XML document in synchronous mode
    doc.async := False;

    //load an XML document from file
    if doc.load ('helloworld.xml'then
    begin
        //extract text value of "message" element
        MessageText := doc.documentElement.childNodes [0].text;
        ShowMessage (MessageText);
    end
    else
        //error loading, display error
        ShowMessage (Format ('Error loading XML document.'#13 +
            'Error number: %d'#13 +
            'Reason: %s'#13 +
            'Line: %d'#13 +
            'Column: %d', [doc.parseError.errorCode,

            doc.parseError.reason,
            doc.parseError.line,
            doc.parseError.linePos]));
end;


end.


Fehler:
doc := CoDOMDocument.Create;
wurde nicht gefunden. Ich habe es aber genau wie in der Hilfe gemacht. Kann mir vielleicht sonst jemand ein Beispiel für die MSXML geben, das funktioniert?

Lg


Moderiert von user profile iconChristian S.: Topic aus IO, XML und Registry verschoben am Mo 23.06.2008 um 19:26
Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mi 25.06.08 12:40 
Musst Du diese MSXML2_TLB verwenden? Verwende doch einfach TXmlDocument, das bietet eigentlich alles, was Du bisher verwendest.
Clemens L.
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 158

Win Xp SP3
D6 Enterprise, Turbo Delphi Explorer
BeitragVerfasst: Mi 25.06.08 13:04 
Ich bevorzuge eh die "JCLSimpleXML" aus der JCL! Funktioniert bei mir immer tadellos und ist eine gute Alternative zu MSXML!
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mi 25.06.08 13:49 
user profile iconClemens L. hat folgendes geschrieben:
Ich bevorzuge eh die "JCLSimpleXML" aus der JCL! Funktioniert bei mir immer tadellos und ist eine gute Alternative zu MSXML!


jop, is große klasse! verwend ich selbst für meine Programme die mehrere Sprachen haben sollen.

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.