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 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

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

Reply via email to