I don't know if this helps you, but I did a little work with XML and
directory structures a while back:

http://www.bennadel.com/blog/503-Creating-An-XML-Representation-Of-A-Dir
ectory-And-Sub-Directories-Using-ColdFusion.htm
Or: http://www.bennadel.com/index.cfm?dax=blog:503.view

It didn't have to identify anything uniquely, but it might help with the
recursion.


......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/

-----Original Message-----
From: Richard White [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 06, 2007 1:23 PM
To: CF-Talk
Subject: ColdFuson XML

Hi,

we are trying to build an xml document that will be used to build a tree
(like the explorer tree in windows). it could be an infinite number of
rows deep and we are trying to build it recursively through code from
data out of a database.

the problem we are having is trying to uniquely reference each element.
for example we are trying to simply build the following:

<rows>
  <row id="tb_1">
    <cell image="onetoonefolder.gif">Once per Subject</cell>
  </row>
</rows>

at present the code we are using to get this is:

MyDoc = XmlNew();
MyDoc.xmlRoot = XmlElemNew(MyDoc,"rows");
  
MyDoc.rows.XmlChildren[1] = XmlElemNew(MyDoc, "row");
MyDoc.rows.XmlChildren[1].XmlAttributes.id = "tb_1";
  
MyDoc.rows.XmlChildren[1].XmlChildren[1] = XmlElemNew(MyDoc, "cell");
MyDoc.rows.XmlChildren[1].XmlChildren[1].XmlAttributes.image =
"onetoonefolder.gif"; MyDoc.rows.XmlChildren[1].XmlChildren[1].XmlText =
"Once per Subject";

Of course you can see that this is not efficient as if we want to go an
infinite amount of levels deep we cannot keep writing:

XmlChildren[1].XmlChildren[1].XmlChildren[1].XmlChildren[1] etc...

we realise that this must go in a loop but was wondering how we can
uniquely name each element and then how do we reference that in a loop.

Thanks very much for your help

richard 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292795
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to