Controlling the ordering of XML Nodes when using TXMLTransformProvider

Go To StackoverFlow.com

2

I'm using a TXMLTransformProvider to edit an XML files using a TClientDataSet (which is pretty cool). I want to be able to control the ordering of the nodes in the XML file - using a primary key or similar. But when I do ClientDataSet1.ApplyUpdates the new records are added to the end of the XML file rather than in my preferred order (the order I see them in the DBGrid). Is there a nice easy way to preserve my order or will I have to abandon my the TXMLTransformProvider for saving data and code it up manually using a TXMLDocument.

2012-04-05 01:27
by Alister
If you think about it, this is the proper behavior - new database records are always appended, and I'm assuming the behavior won't change here.. It's worthy of some vcl inspection to confirm, but my hunch would be to deal with the problem as if your xml file is a database table - John Easley 2012-04-05 12:54
Can't you just use the SaveToFile method of the ClientDataSet and give it a filename like MyData.xml - Michael Riley - AKA Gunny 2012-05-27 16:35


0

I gave up on this and manually outputted the xml from the TClientDataSet using a TXMLDocument, not the prettiest but works all the same.

2012-07-02 05:37
by Alister
Ads