![]() |
Re: XML Datei anlegen
Zitat:
(hab's da nur rauskopiert, das CFG ans XML rangehängt und UTF-8 durch ISO-8859-1 ausgetauscht) [add] einen Unterschied gibt es ... ich hab vorher noch CoInitialize aufgerufen, da ich sonst bei einem nil im Constructor von TXMLDokument selber irgendwann eine Exception erhalte :angel2: |
Re: XML Datei anlegen
Zitat:
|
Re: XML Datei anlegen
jupp ... und es als Datei gespeichert oder geladen ... wie gesagt, siehe Demo in himXML
PS: siehe mein [add] weiter oben ... eventuell ist das ja ein Grund :nerd: Kurzfassung eines der Testcodes von drüben:
Delphi-Quellcode:
Program CheckLibs;
Uses Windows, SysUtils, ActiveX, XMLDOM, XMLIntf, XMLDoc; Var i: Integer; XML: TXMLDocument; Begin Try CoInitialize(nil); WriteLn('fill with 100.000 nodes, save into and load this from a file'); XML := TXMLDocument.Create(nil); XML.Active := True; XML.Version := '1.0'; XML.StandAlone := 'yes'; XML.Encoding := 'UTF-8'; XML.Options := [doNodeAutoIndent]; XML.AddChild('xml'); For i := 0 to 99999 do XML.DocumentElement.AddChild('Node' + IntToStr(i)); XML.SaveToFile('Test.xml'); XML.Free; XML := TXMLDocument.Create(nil); XML.LoadFromFile('Test.xml'); XML.Free; Except On E: Exception do WriteLn(E.Classname, ': ', E.Message); End; WriteLn('press [enter]'); ReadLn; End. |
Re: XML Datei anlegen
Nimm mal die For-Schleife raus!
Edit: CoInitialize ist es nicht. Das ist in diesen Form-Units in irgendeiner automatisch eingebundenen Unit mit dabei |
Re: XML Datei anlegen
jupp ... hab CoInitialize auch nur für die Consolenanwendung benötigt, da es dort keine Forms-Dingens gibt :stupid:
D2009 ... ich kann's dann gern auch nochmal in TDE und D7 versuchen (alles einzeln aufgerufen ... je neuer Programmstart)
Delphi-Quellcode:
// keine Exception
XML := TXMLDocument.Create(nil); XML.Free; // --------------------------- // Benachrichtigung über Debugger-Exception // --------------------------- // Im Projekt CheckLibs.exe ist eine Exception der Klasse EOleSysError // mit der Meldung 'CoInitialize wurde nicht aufgerufen' aufgetreten. // --------------------------- // Anhalten Fortsetzen Hilfe // --------------------------- XML := TXMLDocument.Create(nil); XML.Active := True; <<<< XML.Free; // keine Exception CoInitialize(nil); XML := TXMLDocument.Create(nil); XML.Active := True; XML.Free; // keine Exception CoInitialize(nil); XML := TXMLDocument.Create(nil); XML.Active := True; XML.Version := '1.0'; XML.StandAlone := 'yes'; XML.Encoding := 'UTF-8'; XML.Free; // keine Exception CoInitialize(nil); XML := TXMLDocument.Create(nil); XML.Active := True; XML.Version := '1.0'; XML.StandAlone := 'yes'; XML.Encoding := 'UTF-8'; XML.AddChild('xml'); XML.Free; // und ebenfalls keine Exception CoInitialize(nil); XML := TXMLDocument.Create(nil); XML.Active := True; XML.Version := '1.0'; XML.StandAlone := 'yes'; XML.Encoding := 'UTF-8'; XML.AddChild('xml'); For i := 0 to 9999 do XML.DocumentElement.AddChild(...); XML.Free; |
Re: XML Datei anlegen
Dann hat man den "Bug" wohl in neueren Versionen behoben.
|
Re: XML Datei anlegen
in TDE Update 2 konnte ich so diesen Fehler auch nicht ausfindig machen.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:43 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