Loading XML data into TlistBox [modified]
-
How can I load XML file into TListBox in Delphi 2009? I want to make it possible to click a button and the channel lists will be load on ListBox and end user will click on any of the channel and it will start playing on media player. http://s253696961.online.de/images/bxxda7q6am71jkuwtrb.jpg
modified on Tuesday, July 28, 2009 1:59 PM
-
How can I load XML file into TListBox in Delphi 2009? I want to make it possible to click a button and the channel lists will be load on ListBox and end user will click on any of the channel and it will start playing on media player. http://s253696961.online.de/images/bxxda7q6am71jkuwtrb.jpg
modified on Tuesday, July 28, 2009 1:59 PM
You can load the .xml file in some of the xml components for Delphi, like TXMLDocument. But it is SLOW, takes a LOT of memory and worst of all - have some strange behavior - after accessing a node you have to manually free it. Not to mention that you have to traverse trough nodes until you reach desired branch. If you need a simple job - like taking channels name from xml, I would suggest to open it as a txt file (you can open it trough TStringList for example, and use Text property for direct access) and manually parse it (use PosEx, to incrementally search for node names, and then Copy to extract desired names)