![]() |
AW: Welche Komponete nehme ich zur Darstellung von XML-Dateien?
Zitat:
(den folgenden Source habe ich leicht verändert aus einem bestehenden Projekt kopiert. Eventuelle Syntax-Fehler sind für Dich)
Delphi-Quellcode:
für die DOM-Objekte musst du die MSXML-Typbibliothek importieren. Um das Format des ClientDataset zu erhalten erstellst du die gewünschte Struktur und speicherst sie im XML Format. Dann musst Du dich noch ein bisschen in XSL-Transformation einlesen.
function ImportXML(const xmlFileName, xslFileName: String; var errorMsg: String): Boolean;
var inputXML: IXMLDOMDocument; transormationXSL: IXMLDOMDocument; locData: TClientDataset; begin Result := True; locData := TClientDataset.Create(nil); try try inputXML := coDOMDocument60.Create; inputXML.async := False; inputXML.validateOnParse := False; transormationXSL := coDOMDocument60.Create; transormationXSL.async := False; transormationXSL.validateOnParse := False; if not inputXML.load(xmlFileName) then raise Exception.CreateFmt('%s', [inputXML.parseError.reason]); if not transormationXSL.load(xslFileName) then raise Exception.CreateFmt('%s, XSL-File: %s', [transormationXSL.parseError.reason, xslFileName]); locData.XMLData := inputXML.transformNode(transormationXSL); locData.Open; while not locData.EOF do begin // Do The Import here // Do Commit here if you want to commit every single record locData.Next; end; // Do Commit here if you want to commit the whole import or nothing finally locData.Free; end; except on e: Exception do begin errorMsg := e.Message; //DB.Rollback; Result := False; end end; end; |
AW: Welche Komponete nehme ich zur Darstellung von XML-Dateien?
Nun, da müsste ich bei jedem Filter wieder neu die Datei öffnen.
Werde mich jetzt mal an erste Versuche wagen, danke! |
AW: Welche Komponete nehme ich zur Darstellung von XML-Dateien?
Zitat:
|
AW: Welche Komponete nehme ich zur Darstellung von XML-Dateien?
Kann man die Microsoft xml Implementierung auch dazu bewegen die xml-datei mit ordentlichem Zeilenumbruch zu schreiben, sodass man diese auch mit einem Texteditor wie Notepad anschauen kann?
|
AW: Welche Komponete nehme ich zur Darstellung von XML-Dateien?
Zitat:
Beim TXMLDocument steckt dieses in den .Options unter irgendwas mit "Ident". |
AW: Welche Komponete nehme ich zur Darstellung von XML-Dateien?
Hallo Himitsu,
Danke für den 'Tip'. Nach dem Ding hätte ich bestimmt noch ein Jahr suchen können. Na und wenn in 5 Jahren der Delphi-Mac-Compiler kommt, kann ich das dann ehedem auf Dein XML umstellen. Grüße aus Hannover Martin |
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:07 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