Getting row items in correct order


I’m trying to do some automation based on ooutline files (not in OmniOutliner itself), using the contents.xml file.

It seems to be pretty straightforward, but I’m not sure how to establish the same item (row) order as in OO Pro itself. There seems to be a “rank” attribute:

<item id="df702wnIjta" rank="00143f">

which looks like a hex number. However, sorting by that number doesn’t yield the expected result. The items are also not simply in the same order inside the file as they appear in the outline document in OO.

Does anybody know how to get the correct order here? Do I need to interpret the “rank” attribute somehow differently?

Some strange behavior of that “rank” attribute: When I do a blank outline and add a few items, those have basically rank “”, “0001”, "0002, “0003” in order. When I now add a new first row in front of the existing ones, this will be rank “00ff” (255), and a new first row in front of that will be inserted as “00fe” (254).

Solution for other people with the same issue:

So after some fiddling around I realized that “rank” is indeed the key to sort, but it’s not a hex number, it’s just an alphabetic sort key. Example:


“00033f” has been inserted here inbetween the two other rows, simply by extending the previous rank 0003.

Ken Case once explained that it’s hex for a signed integer.

Each byte should be considered a signed 8-bit integer (so those 0xfd and 0xff bytes are both negative).

(it can appear to be alphabetic for a while, but I think that impression that will break down quite soon on further testing)


Aaah that makes it much clearer. Thanks!