Help needed with ConvertXMLToArray

Richard Gaskin ambassador at fourthworld.com
Wed Mar 18 10:32:01 EDT 2015


Graham Samuel wrote:

 > If you do a numeric sort by these numbers, 1000 will come before 9.

If a numeric sort produces that outcome either the data isn't purely 
numeric or you've found a bug.


 > Without this, an XML file with child nodes in a certain order will
 > end up in a different order when converted to an array - and an order
 > that isn't that easy to modify at this point.

LiveCode's arrays are associative arrays, in which elements have no 
inherent order relative to one another.

Keys are associated with values by a hash that determines the memory 
location of the value, and like most hashes the result maintains no 
metadata which describes either insertion order or order relative to 
other key values.

We can access array elements with a sense of order by first obtaining 
the keys and sorting those in whatever way is needed for the task at 
hand (numeric, alphanumeric, dateTime, etc.; provided of course the sort 
command works as questioned above).

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list