Inserting into XML tables at arbitrary points

Brian Andresen brian at techsoln.com
Wed Mar 20 08:09:00 PST 2002


On 3/19/2002 2:11 PM, Bill Humphries <whump at apple.com> wrote:

>On 3/19/2002 1:43 PM, Brian Ablaza <bablaza at stargroup1.com> wrote:
>
>>I always thought that the reason for the 9-digit number with digits 
>>in the middle of zeros for object names in Frontier xml tables was 
>>specifically to address your issue. After all, Userland could have 
>>chosen to name element 5 "000000005\tfoo".

And in fact, that's where things started.  suites.xml (later known as 
blox) first used a 4-digit, right-justified prefix, e.g. "0005_foo".  
Doug improved on this by expanding it to the 8-digit format that has 
padding on both sides, exactly for the reason presented here:

>>If you need to insert an element between element 5 and element 6, 
>>just preface it with 000050010 (or some such).

I'd recommend 00005500, for maximum flexibility.  Add the next one at 
00005250 or 00005750, and so forth.  The optimal numbering does depend on 
whether insertions are done in an ordered or random pattern.

>>You can therefore 
>>insert up to 9,999 elements between element 5 and element 6.

RIght.  Adding more requires that the elements be renumbered.  Presuming 
that these elements are being added programatically, one may want to 
consider renumbering at some threshold lower than 10,000.

>>I have never seen any documentation to indicate that there is a 
>>permanent relationship between the name of the xml object and its 
>>index in the table, so I don't think anything will break. In fact, I 
>>believe that the more important function of the leading number string 
>>is to allow objects with the same name to co-exist in the same table 
>>(something that is not permitted in Frontier, but is common in xml). 

Yes, the prefixing was designed to solve this problem and the custom 
ordering problem simultaneously.

>Hey Dave! Can we get a clarification on this?

I'm not Dave, but the prefixing system came out of a collaboration 
between UserLand and myself, so I hope I can still speak with some 
authority on it.  I guess it's possible that some kernel code makes 
assumptions about the actual numbers used in the prefix, but I doubt it.  
If I was writing code to add elements to XML tables, I would take the 
approach described herein.

-Brian




More information about the Frontier-Users mailing list