Hey guys I'm trying to see if someone can give me a nudge in the right direction here.

All I need is two simple procedures:

1. Load XML Entries into TListBox

2. When ListBox is clicked, find string pointing to filename so I can display the item's associated file.

My XML file is structured like this:

<?xml version="1.0" standalone="yes"?>

<Dictionary>
<Item Name="A Kempis, Thomas">
<Definition>A Kempis Thomas.html</Definition>
</Item>


<Item Name="A solis ortus cardine">
<Definition>A solis ortus cardine.html</Definition>
</Item>
</Dictionary>


So procedure 1 would load Item Names into the ListBox, then another procedure called in the ListBox's onclick would search <item> for <definition> which is a filename to be loaded into string.

Can someone help me please?

Right now I'm using TXMLTransform, TClientDataSet and TDataSource and it's VERY slow. I'm working with a lot of items, so I'm hoping eliminating the DB comps will speed things up a bit.
I'm working with over 12 thousand items.

So far I have this code, but I'm not sure how to cycle through items etc.

procedure TForm1.LoadDict;
var
  XMLPath   : String;
  XMLReader : TXMLDocument;
  iNode    : Integer;
  mystr: String;
  begin
  XMLPath   := ExtractFilePath(Application.ExeName) + '\data\Dictionary.xml';
  XMLReader := TXMLDocument.Create(Self);
  XMLReader.LoadFromFile(XMLPath);
  XMLReader.Active    := True;


{No Idea where to start}

end;

You might be able to drop the xml transform as tclientdataset understands xml direct if its simple enough.

Failing that, I wouldnt use xml -> IMHO xml is often over used when something as simple as a simple ini file/registry keys would be more than sufficient.

You might be able to drop the xml transform as tclientdataset understands xml direct if its simple enough.

Failing that, I wouldnt use xml -> IMHO xml is often over used when something as simple as a simple ini file/registry keys would be more than sufficient.

That's what I'm trying to do here, drop the data comps altogether, I'm hoping TXMLFile will provide the functionality I need but I can't find an examples that suit my need stated here.

The problem I found with using XML is you seem to need to know way too much for the purpose of a "generic" XML file..

Why use XML in the first place?

The problem I found with using XML is you seem to need to know way too much for the purpose of a "generic" XML file..

Why use XML in the first place?

The XML File is over 2mb, and it's an essential database, I can't go without it.

I've already decided on it, but I was hoping someone could show me some code to do what I'm trying to do here so I can ditch the DB comps.

Converting this file to another format would be a massive pain, and is totally not what I'm trying to do.

OK, but by the sounds of it XML is not really the best format to have picked - having picked it you either can as previously suggest check and see if tclientdataset will read it in direct, or, you have to go through the process you have - and yes its slow which is why XML is not really a great avenue for so many smaller things (2mb is nothing)

You already had code to do what you wanted - you just didnt like it, the sad part is in having XML it *IS* going to be slower.

See the "No Idea Where to Start" comment in my code block. The code I pasted doesn't actually DO anything I asked for help with. The code that's missing is what I'm asking for here.

This article has been dead for over six months. Start a new discussion instead.