![]() |
Re: himXML (gesprochen himixML)
Einen "schönen" Lizenztext hab ich noch nicht,
aber es soll Opensource, Freeware und in notfalls kommerziellen Projekten nutzbar sein ... also irgendwas in Richtung GPL. Da gibt es ja soooo viel, da was passendes rauszusuchen wird bestimmt auch nochmal 'ne Heidenarbeit werden :? |
Re: himXML (gesprochen himixML)
Zitat:
|
Re: himXML (gesprochen himixML)
Zitat:
aber es gab ja schon ein paar Threads hier, wo es um Lizenzen ging ... mal sehn welche ich davon wiederfind und was mir dort dann gefällt. Das Einzige, auf was ich mich vor langem schon geeinigt hab ist, daß ich nicht unmassen an Kraft in sowas wie einen Kopierschutz, bei vielen meiner Programme, reinstecken und diese zum Verkauf anbieten werde. Fazit: es gibt 'nen unverbindlichen Spendenlink (damit dennoch wer etwas abgeben kann, wenn ihm was gefällt :angel: ) zum Thema: ich bin eben dran das Array der Node-Liste auf eine mehrfach verkettete Liste umzustellen und dabei ist mir auch grad die Idee gekommen XML.RootNode und XML.Nodes quasi auszuzauschen, also die Nodes der obersten Ebene (aktuell in XML.Nodes) in irgendwas Anderes umzubenennen und den .RootNode (den Basisknoten der XML-Daten) in .Nodes umzubenennen und dessen wichtigste Grundfunktionen ebenfalls in die XMLFile-Klasse zu integrieren (also so ähnlich wie schon bei den wichtigsten Grundfunktionen der untergeordneten NodeList in dessen übergeordneten Node) man müßte dann nicht ständig XML.RootNode.Node sondern direkt XML.Node nutzen einige in TXMLNode integrierte Funktionen der untergeordneten TXMLNodeList: Zitat:
würde jemand was dagegen haben? (ihr habt noch etwas Zeit zum überlegen, ich mach erstmal die aktuelle Array-Umstellung fertig) |
Re: himXML (gesprochen himixML)
Zitat:
Also beim "Nachbilden" meiner bisherigen INI-Files gehe ich so vor:
Delphi-Quellcode:
Mit meinem simplen Verständnis komme ich gut damit klar. Wir würde sowas in der neuen Aufteilung aussehen?
var
XML : TXMLFile; SecNode, DataNode : TXMLNode; begin XML := TXMLFile.Create(nil); XML.RootNode.Name := 'Im_a_Rootname'; // with Blöcke with XML.RootNode.Nodes.Add('Section_1') do begin Attributes.Add('methode','with bloecke'); with AddNode('Value_1') do Data := 'Section 1 Value 1'; with AddNode('Value_2') do Data := 'Section 1 Value 2'; end; // Klassisch SecNode := XML.RootNode.Nodes.Add('Section_2'); SecNode.Attributes.Add('methode', 'klassisch'); DataNode := SecNode.AddNode('Value_1'); DataNode.Data := 'Section 2 Value 1'; DataNode := SecNode.AddNode('Value_2'); DataNode.Data := 'Section 2 Value 2'; XML.SaveToFile('F:\WorkTemp\himXMLtest.xml'); XML.Free; btw. die with-Blöcke schreibe ich so, weil ich es schlank mag:
Delphi-Quellcode:
Aber ich will nicht, das Ihr das seht und habe es vorm posten geändert... :oops: (aber bitte nicht himitsu's thread mit einer Diskussion darüber "versauen", Danke)
with XML.RootNode.Nodes.Add('Section_1') do begin
Attributes.Add('methode','with bloecke'); with AddNode('Value_1') do Data := 'Section 1 Value 1'; with AddNode('Value_2') do Data := 'Section 1 Value 2'; end; |
Re: himXML (gesprochen himixML)
Wo ich das grad sah ....
Delphi-Quellcode:
Nodename jetzt [add](also beim nächsten Update)[/add] im Create mit integriert (wenn man es denn nutzen möchte)
XML := TXMLFile.Create(nil);
XML.RootNode.Name := 'Im_a_Rootname';
Delphi-Quellcode:
(macht sich für den nächsten Schritt auch einfacher)
XML := TXMLFile.Create(nil, 'Im_a_Rootname');
Zitat:
Delphi-Quellcode:
es wäre praktisch so, daß die XML-Klasse dann selber wie ein Node (der RootNode) nutzbar wäre
var
XML : TXMLFile; SecNode, DataNode : TXMLNode; begin XML := TXMLFile.Create(nil, 'Im_a_Rootname'); // with Blöcke with XML.AddNode('Section_1') do begin Attributes.Add('methode', 'with bloecke'); AddNode('Value_1').Data := 'Section 1 Value 1'; AddNode('Value_2').Data := 'Section 1 Value 2'; end; // Klassisch SecNode := XML.AddNode('Section_2'); SecNode.Attributes.Add('methode', 'klassisch'); DataNode := SecNode.AddNode('Value_1'); DataNode.Data := 'Section 2 Value 1'; DataNode := SecNode.AddNode('Value_2'); DataNode.Data := 'Section 2 Value 2'; XML.SaveToFile('F:\WorkTemp\himXMLtest.xml'); XML.Free; Zitat:
Zitat:
Delphi-Quellcode:
with XML.AddNode('Section_1') do begin
Attributes['methode'] := 'with bloecke'; AddNode('Value_1').Data := 'Section 1 Value 1'; AddNode('Value_2').Data := 'Section 1 Value 2'; end; |
Re: himXML (gesprochen himixML)
Also mir würde die neue Aufteilung keine Schwierigkeiten bereiten und die angesprochenen Vorteile sehe ich genauso.
Das man beim Lesen dann XML(file) gleich als den Baum itself sieht, ist wirklich eleganter. Die Anwendung mit with ist nochmal etwas kompakter. Mein Fazit: Fand die bisherige Variante Ok, der neue Vorschlag nochmal besser. Mal sehen, ob sonst noch jemand was zu schreibt, aber allgemein wirf die Klasse scheinbar nicht viele Fragen/Kritik auf. |
Re: himXML (gesprochen himixML)
OK, dann setz ich mich mal daran :-D
Für Leute wie Luckie, ist die Classes-Unit "deaktivierbar" (siehe Compilerschalter UseClassesUnit in himXML.pas). Allerdings gehen dann einige Funktionen flöten, da ich dann nicht jeden popligen Stream redefinieren will.
Delphi-Quellcode:
In der himXML_Tools.pas wurde an entsprechender Stelle (TXMLIniFile.ReadBinaryStream und Co.) eine Umleitung eingebaut, da dort Aufgrund der Nutzung von TStringList Classes nicht deaktiviert werden kann (falls man diese Zusatzunit nutzt und in himXML.pas es dennoch abgeschaltet hat)
TXMLFile = Class
Public {$IFDEF UseClassesUnit} Procedure LoadFromResource(Instance: THandle; Const ResName: String; ResType: ... Procedure LoadFromResource(Instance: THandle; ResID: Integer; ResType: ... Procedure LoadFromXML (Const XMLString: AnsiString); Procedure LoadFromXML (Const XMLString: TWideString); Procedure SaveToXML (Var XMLString: AnsiString); Procedure SaveToXML (Var XMLString: TWideString); Property asXML: AnsiString; {$ENDIF} End; TXMLNode = Class Public {$IFDEF UseClassesUnit} Property XMLData: TWideString; {$ENDIF} End; Die Demo_Tree.dpr würde überarbeitet: es gibt jetzt eine Ladefortschrittsanzeige und das Füllen der Treeview kann via [X] abgebrochen werden :stupid: Die Parsingfunktion wude überarbeitet, an vielen Stellen gab es ja 2 Funktionsaufrufe pro gelesendem Zeichen
Delphi-Quellcode:
stattdessen gibt es jetzt nur noch eine Funktions, in welcher durchschnittlich nur noch eine optimiertere Inline-Funktion pro Zeichen vorkommt. :nerd:
While _CheckLen(i, i, P) and CheckChar(P[i], xcSpace) do Inc(i);
Delphi-Quellcode:
(wenn ich da alles geprüft hab, dann kommen die alten, auskommentieren Schleifen auf der TXMLFile.ParsingTree raus)
_Search(P, i, 0{isSpace...});
Hab noch 'nen krasses SpeedUp hinbekommen (teilweise um über 90% runter) und das vorwiegend nur dadurch, daß ich Delphi teilweise die "sinnlose" Speicherverwaltung abnahm. :wall: Speziell Length(S) und S[x] für Wide-/UnicodeStrings hab ich durch eigene Inline-Funktionen ersetzt. Was hatt denn bitte sehr ein UniqueString in Length zu suchen? :evil: (und das was noch nichtmal alles) Dann bin ich sehr überrascht: Erstmal ist D2009 manchmal sogar einen Hausch schneller, als TDE und die Dateigrößer :shock: Und normaler Weise wird doch mit jeder neuen Delphi-Version die EXE etwas größer, aber ... (die CheckLibs.dpr mit allen Tests für meine Lib und die anderen Libs deaktivert) > TDE > 471 KB > D09 > 224 KB Und auch wenn beim UnicodeString mehr intern passiert, wirkt sich insgesammt die Refferenzzählung etwas positiver aus. :thumb: Nur das mit den Dateigrößen ist mir im Moment noch etwas schleierhaft. OK, dafür verbraucht TDE teilweise bis 10% weniger RAM. :stupid: Da Aufgrund der neuen Node-Verwaltung TXMLNode um 8 Byte größer wurde, passen jetzt nicht mehr über 4.000.000 der Testnodes (incl. 2 Attributen und etwas Text) in 2 GB RAM, sondern nur noch 2.500.000 bis 2.800.000 (je nach Speicherfragmentierung und -auslastung) aktuelle Tests/Vergleiche:
Code:
> Delphi 2009 (CheckLibs_D2009.exe)
> Turbo Delphi Explorer (CheckLibs_TDE.exe) > alle Tests komplett (CheckLibs.exe bzw CheckLibs.dpr) ******************************************************************************** ***** Delphi 2009 ************************************************************** ******************************************************************************** fill TXMLFile with 10.000 nodes and save this into a file create:0 fill:10 save:6 free:3 fill TXMLFile with 10.000 nodes, delete 8.000 nodes and save this into a file create:0 fill:10 delete:355 save:3 free:0 fill TXMLFile with 10.000 nodes with attributes and save this into a file create:0 fill:26 save:14 free:4 fill TXMLFile with 100.000 nodes, save into and load this from a file create:0 fill:225 save:134 free:50 create:0 load:349 free:47 fill TXMLFile with 10.000 nodes with attributes and search nodes create:0 fill:26 search:2519 free:4 fill TXMLFile with 3.500.000 nodes, save into and load this from a file create:0 fill:16895 save:11906 free:2489 create:0 load:24578 free:2376 load a file into TXMLFile with 3.500.000 nodes as SAX mode create:0 load:32381 free:0 ******************************************************************************** ***** Turbo Delphi Explorer **************************************************** ******************************************************************************** fill TXMLFile with 10.000 nodes and save this into a file create:0 fill:13 save:6 free:3 fill TXMLFile with 10.000 nodes, delete 8.000 nodes and save this into a file create:0 fill:14 delete:391 save:3 free:0 fill TXMLFile with 10.000 nodes with attributes and save this into a file create:0 fill:42 save:18 free:7 fill TXMLFile with 100.000 nodes, save into and load this from a file create:0 fill:332 save:176 free:87 create:0 load:463 free:97 fill TXMLFile with 10.000 nodes with attributes and search nodes create:0 fill:45 search:2669 free:8 fill TXMLFile with 3.500.000 nodes, save into and load this from a file create:0 fill:24055 save:15371 free:5979 create:0 load:31400 free:6208 load a file into TXMLFile with 3.500.000 nodes as SAX mode create:0 load:48734 free:0 ******************************************************************************** ***** komplett (D2009) ********************************************************* ******************************************************************************** SetProcessAffinityMask: OK use QueryPerformanceCounter precreating used strings - do not create and convert this within the measuring create:39 fill TXMLFile with 10.000 nodes and save this into a file create:0 fill:9 save:6 free:2 fill MS-XML-DOM with 10.000 nodes and save this into a file create:3 fill:6827 save:157 free:0 fill ThaXML with 10.000 nodes and save this into a file create:0 fill:4 save:11 free:33 fill TXMLFile with 10.000 nodes, delete 8.000 nodes and save this into a file create:0 fill:9 delete:392 save:3 free:0 fill MS-XML-DOM with 10.000 nodes, delete 8.000 nodes and save this into a file create:0 fill:6778 delete:88233 save:88 free:0 fill ThaXML with 10.000 nodes, delete 8.000 nodes and save this into a file create:0 fill:4 delete:35 save:0 free:0 fill TXMLFile with 10.000 nodes with attributes and save this into a file create:0 fill:26 save:36 free:5 fill MS-XML-DOM with 10.000 nodes with attributes and save this into a file create:0 fill:6819 save:113 free:0 fill ThaXML with 10.000 nodes with attributes and save this into a file create:0 fill:5 save:11 free:33 fill TXMLFile with 100.000 nodes, save into and load this from a file create:0 fill:211 save:134 free:48 create:0 load:324 free:43 fill MS-XML-DOM with 100.000 nodes, save into and load this from a file create:0 fill:750833 save:247 free:0 create:0 load:317 free:93 fill ThaXML with 100.000 nodes, save into and load this from a file create:0 fill:46 save:117 free:2922 create:0 load:401087 free:2920 fill TXMLFile with 10.000 nodes with attributes and search nodes create:0 fill:25 search:2577 free:4 fill MS-XML-DOM with 10.000 nodes with attributes and search nodes create:0 fill:6985 search:140237 free:0 fill ThaXML with 10.000 nodes with attributes and search nodes create:0 fill:5 search:10136 free:33 fill TXMLFile with 3.500.000 nodes, save into and load this from a file create:0 fill:15785 save:11503 free:2400 create:0 load:24203 free:2268 fill MS-XML-DOM with 3.500.000 nodes, save into and load this from a file error: das ist wirklich keinem zumutbar fill ThaXML with 3.500.000 nodes, save into and load this from a file error: EOutOfMemory würde sich so ab 2.000.000 melden error: ab etwa 500.000 braucht .Free ewig und es steigt expotentiel an es sind hiermit also efektiv nicht viel mehr als 200.000 möglich fill ThaXML with 200.000 nodes, save into and load this from a file create:0 fill:242 save:1054 free:11694 error: das Laden würde ewig brauchen fill ThaXML with 15.000 nodes, save into and load this from a file create:0 fill:17 save:62 free:54 create:0 load:47741 free:54 load a file into TXMLFile with 3.500.000 nodes as SAX mode create:0 load:31928 free:0 load a file into MS-XML-DOM/SAX with 3.500.000 nodes as SAX mode error: ich weiß noch nicht wie das geht load a file into ThaXML with 3.500.000 nodes as SAX mode error: this class do not support this press [enter] ![]() ( ~1 MB incl. 2 XML-Testdateien und den wichtigsten Binaries ) |
Re: himXML (gesprochen himixML)
ihr werdet es nicht glauben, aber es gibt nun auch einen SAX-Parser :oops:
er benutzt fast die selbe Leseroutine wie TXMLFile, nur daß diese aufgesplittet und etwas modifiziert wurde.
Code:
er ist auch garnicht so schwer zu nutzen
fill TXMLFile with 3.500.000 nodes, save into and load this from a file
create:0 fill:15852 save:10416 free:2378 create:0 load:24470 free:2237 load a file into TXMLFile with 3.500.000 nodes as virtual SAX mode create:0 load:32710 free:0 load a file over TSAXParser with 3.500.000 nodes create:0 load:14488 free:0
Delphi-Quellcode:
SAX := TSAXParser.Create(nil);
Try SAX.Open('Test.xml'); While SAX.Read(Node, B) do Begin ... End; Finally SAX.Free; End;
Delphi-Quellcode:
wird dann mit'm nächsten Update hochgeladen
TSAXParser = Class
Procedure Open(Const FileName: TWideString); Procedure Open(Stream: TStream; ...); Procedure Open(Buffer: Pointer; Len: Integer; ...); Property FileName: TWideString; Procedure Close; Property Options: TXMLOptions; Property Version: TWideString; Property Encoding: TWideString; Property Standalone: TWideString; Property Levels: Integer; Property Node[Level: Integer]: TSAXNode; Function Read(Out Node: TSAXNode; Out isClosedTag: Boolean): Boolean; Function Progress: LongInt; End; TSAXNode = Class Property Level: Integer; Property NodeType: TXMLNodeType; Property FullPath: TWideString; Property Name: TWideString; Property Namespace: TWideString; Property NameOnly: TWideString; Property AttributeCount: Integer; Property AttributeName[Index: LongInt]: TWideString; Property Attribute[Const IndexOrName: TIndex]: Variant; Property isOpenedTag: Boolean; Property Data: Variant; Property SubNodes: Integer; End; |
Re: himXML (gesprochen himixML)
Hi himitsu, ich hab mir jetzt zwar den ganzen Thread durchgelesen, muss aber trotzdem nochmal fragen, ob das Teil auch mit D6 funzt? Wenn das so weiter geht, könnte ich ja evtl. OmniXML ablösen, was ja nicht grad klein ist. Für den SAX-Parser nehm ich momentan LibExpatW
Wg der Lizenz - Nimm doch einfach die vom VST - Kombination von MPL und GPL. Ist sicher eine gute Lösung. Ansonsten evtl. die Apache-License. VG, Sven |
Re: himXML (gesprochen himixML)
Aktuell ist ist es (hab's vor kurzem auch mal im ersten Post eingefügt) ab Delphi 2006 bzw Turbo Delphi und auch Delphi 2009 kompatibel.
Weiter Runter ist geplant, aber aufgrunde des Aufwandes für einen Zeitpunkt geplant, wo das Projekt etwas ausführlicher getestet ist. Immerhin wird es dann eine Extra-/Nebenversion und es wäre zu aufwendig dann eventuelle grobe Fehler dann in 2 Versionen einzeln beheben zu müssen. Aber da es aktuell gut läuft und wird diese Version wohl bald soweit sein, daß ich mit der anderen anfangen kann ... aber bis wie weit ich runterkomm, weiß ich noch nicht ... muß ich erst ausprobieren, wobei ich es selber bis auf D7 runterbekommen könnte (dieses hab ich noch, um selber testen zu können) Zitat:
TXMLFile > erstellen 15s 21 MB/s > schreiben 10s 33 MB/s > lesen 25s 14 MB/s TSAXParser > lesen 15s 23 MB/s getestet mit 4 GB RAM und 3 GHz |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:42 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 by Thomas Breitkreuz