Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.306 Beiträge
 
Delphi 12 Athens
 
#6

Re: TXMLDocument Struktur erstellen jedoch bleibt die Datei

  Alt 8. Dez 2008, 20:40
hast du mal ohne FormatXMLData gespeichert? (wenn da noch alles da ist, dann stimmt wohl an deinerder FormatXMLData-Funktion etwas nicht)

Also ich laß bei mir so die XML Dateien erstellen
und praktisch dabei ist, daß bei mir alles schön formatiert ist
Delphi-Quellcode:
XMLDoc := TXMLDocument.Create(Application);
Try
  XMLDoc.Active := True;
  XMLDoc.Version := '1.0';
  XMLDoc.Encoding := 'UTF-8';
  XMLDoc.StandAlone := 'yes';
  XMLDoc.Options := [doNodeAutoCreate, doNodeAutoIndent, doAttrNull];
  XMLDoc.AddChild('tables');

  for Idx := 0 to High(Tables) do begin
    ItemNode := RootNode.AddChild('tab'+IntToStr(Idx));
    ItemNode.Attributes['name'] := Tables[Idx].Name;
  end;{for}

  XMLDoc.SaveToFile('tables.xml');
Finally
  XML.Free;
End;
wichtig dabei ist doNodeAutoIndent in den Options

[add]
hab mal nach FormatXMLData gesucht und soweit ich das Seh, macht dieses nichts anderes, als den XML-String in ein neues XML-Dokument zu laden, dann alle Nodes wiederum in ein weieres XML-Dokument zu kopieren und dann dieses wieder in einen XML-String ... und du kopierst vorher Dokument in einen string und hinterher andersrum ... also warum erst hinundherkopieren und nicht gleich formatiert erstellen?
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat