![]() |
Attributes? Was mache ich falsch?
Holla,
Ich habe folgenden Code um eine XML-Datei mithilfe des TXMLDocuments zu erstellen:
Delphi-Quellcode:
Das Problem an der Sache ist nur das die Struktur wie ich sie nachher haben will so nicht stimmt. Nachher sollte es nämlich so aussehen:
procedure TForm1.Button1Click(Sender: TObject);
var xml : TXMLDocument; node : IXMLNode; begin xml:=TXMLDocument.Create(Self); xml.Active:=true; node:=xml.AddChild('artworkinfo'); node:=node.AddChild('albuminfo'); node := node.AddChild('artlocation'); node.Attributes['artlocation'] := 'Image.jpg'; node:=node.ChildNodes.First; xml.SaveToFile('C:\test.xml');
Delphi-Quellcode:
- <artworkinfo> - <albuminfo> <artLocation>Stella_and_Henry_Hot_Dogs_2.JPG</artLocation> <trackName>Hot Diggity Dog</trackName> <artist>Kirupa Chinnathambi</artist> <albumName>Time For Lunch</albumName> <httptype>artwork/</httptype> </albuminfo> - <albuminfo> <artLocation>tha_album.gif</artLocation> <trackName>Yo Yo Yo</trackName> <artist>Some Black Rapper</artist> <albumName>Tha Album</albumName> <httptype>artwork/</httptype> </albuminfo> wie schaffe ich es denn das es von der struktur her so ist? Danke Lg |
Re: Attributes? Was mache ich falsch?
Hallo,
du willst kein Attribut setzen, sondern den Content:
Delphi-Quellcode:
Grüße vom marabu
node.text := 'content';
|
Re: Attributes? Was mache ich falsch?
Warum in die Ferne schweifen, das schöne liegt doch so nah.
:D Vielen Dank! |
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:23 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