Navigating XML in LiveCode

Michael Kann mikekann at yahoo.com
Sun Jan 22 10:46:14 EST 2012


Graham,

Without giving away any trade secrets, could you describe where the data is stored and how it will be displayed? 

Mike

--- On Sun, 1/22/12, Graham Samuel <livfoss at mac.com> wrote:

From: Graham Samuel <livfoss at mac.com>
Subject: Navigating XML in LiveCode
To: use-livecode at lists.runrev.com
Date: Sunday, January 22, 2012, 8:45 AM

For no special reason I have never used XML, either in LiveCode or anywhere else. Now I'm scripting an app that calls for a tiny database containing a number of similarly structured records (probably not more than 50), with all the values essentially text or numbers easily expressible as text. XML seems a good fit for this, but there are some odd bits I can't understand despite reading Sarah Reichelt's useful tutorial and looking at the LiveCode dictionary and the User Guide.

The issue is this - suppose I want to add a node to my data structure before I have any data (attributes or node contents) to put into it: for example in an employee list, I want to create an <employeeDetails> node as a member of a set of nodes all with that name - I may want to add subnodes too at the moment of creation, but that's not the real issue. 

My next step will be to make that particular instance of <employeeDetails> unique by giving it an attribute like say "EmployeeID" with a unique value. The problem is that I can't apparently do this in one step, although I would like to, so as to make sure that my new node can immediately be identified, searched for etc. First I have to create the node, and afterwards I want to add my attribute. But how can I find it? I suppose I could search for a node that hasn't got an "EmployeeID" attribute yet, or I could parse the whole structure to find the last node at that level, but both these methods seems kind of crude. Is there some way to keep track of the last node created, similar to LiveCode's feature within the creation of new objects? If there is, I can't find it. Or maybe I'm just thinking about it in the wrong way.

Any help would be appreciated, as ever.

Graham

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list