|
Structure to File RequestI noticed with the "Kineme Structure to File" patch, that when it saves as structure, that it reorders it into alphabetical order. Is there a way thatan option can be added to disable this behavior? The reason I ask is that I'm having to shoe in some fault tolerance into a project that runs on an unreliable network, so I'm building an XML caching system that will save this XML feed locally and only update the display when a newer version of the feed is downloaded. The problem being is that since Structure to File alphabetizes the contents of the feed when it saves it, it reorders the values throughout the entire composition. Is there something else maybe I'm missing that would be a better way to handle this?
|
Trick is to key your XML structure with tags that are meaningful ie. give the order you want. Then you can pull items by relevant unique key. Either that or use Javascript to iterate and find the item index by testing for a unqiue data value inside object somewhere.
This question has made me realise there is no patch to find an element/item inside a structure by matching a data vaue, only index (problematic*) and key.
*creating structures by iterating in Javascript results in a structure with jumbled index order so keys are required in many cases.
Standard Cocoa
NSDictionary
s are unordered; standard CocoaNSArray
s are unkeyed. Internally, QC Structures are represented asGFList
s, a special QC-specific type that allows data to be both ordered and keyed.Currently
Structure To File
is converting the structure to an NSDictionary, then writing it to disk.Structure From File
does similarly. This is why you're seeing the reordering.I just published a new FileTools beta, in which
Structure To File
andStructure From File
have been modified to save the structure with an alternate encoding, preserving order.Thanks so much for this, this is going to help immensely.
Your realization is actually a challenge I'm going to have to attack in the near future. I'm pulling an XML feed from MS SharePoint, which I'm going to have to compare to another feed, and generate a new structure from that. It's going to be exciting.
Thankfully SharePoint is somewhat nice in the feeds it generates:
Which is super handy because it gives a description of the data in the "Schema id" section, which allows me to automatically create the names and category titles for the stuff that's under the data section "z:row".
Fun!