![]() |
Delphi-Version: 10.2 Tokyo
Delphi 10.2.3 und XML
Ich möchte eine XML Datein lesen
Code:
Hier ist mein Code
<?xml version="1.0"?>
<config> <db> <username>dfdff</username> <password>dfdfd</password> <server>1.1.1.1.</server> <db>dfdfdffdf</db> <dbport>3306</dbport> <povider>MySQL</povider> </db> <port>35353</port> <httpport>88</httpport> </config>
Delphi-Quellcode:
Vorher habe ich noch
var
LDocument: IXMLDocument; LNodeElement : IXMLNode; begin LDocument := TXMLDocument.Create(nil); if FileExists(FConfigFile) then Begin LDocument.LoadFromFile(FConfigFile); LNodeElement:=LDocument.DocumentElement.ChildNodes['db']; if LDocument<>Nil then Begin FDB.UserName:=LDocument.DocumentElement.ChildNodes['db'].ChildNodes.Nodes['username'].NodeValue; FDB.UserName:=LNodeElement.ChildNodes.FindNode('username').Text; FDB.Password:=LNodeElement.ChildNodes.FindNode('password').Text; FDB.Server:=LNodeElement.ChildNodes.FindNode('server').Text; FDB.DB:=LNodeElement.ChildNodes.FindNode('db').Text; FDB.Port:=StrToIntDef(LNodeElement.ChildNodes.FindNode('port').Text,3306); FDB.Provider:=LNodeElement.ChildNodes.FindNode('provider').Text; End; LNodeElement:=LDocument.ChildNodes.FindNode('config'); if LDocument<>Nil then Begin FPort:=StrToIntDef(LNodeElement.ChildNodes.FindNode('port').Text,88); End; End; DefaultDOMVendor:=sOmniXmlVendor; Jetzt zu meine Problem ich bekomme immer Exceptions egal was ich versuche. Habe ich da irgendwo ein Gedanken Fehler |
AW: Delphi 10.2.3 und XML
versuch mal:
LDocument.Active := True; direkt nach dem Document.Loadfromfile.... |
AW: Delphi 10.2.3 und XML
Danke das war es
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:27 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz