I know this could be one solution. But, finding a depth of a node in XML, is a very trivial operation. I believe flex has some implementation for this. If this could be done in flex then it is waste to insert an extra column in XML.

I am sorry Still I did not get exactly the depth concept you're talking about. Well make me clear with this..

Tell me depths of all the below highlighted items..??

<?xml version="1.0" encoding="ISO-8859-1"?>

<root>

<node label="Session">

<node id="session_query1" label="DTM Buffer Size" />

<node id="session_query2" label="Buffer Block Size"/>

<node id="session_query3" label="Enable Test Load"/>

</node>

<node label="Workflow" >

<node id="workflow_query1" label="Enable HA Recovery"/>

<node id="workflow_query2" label="Suspend on Error"/>

</node>

<node label="Mapping">

<node id="mapping_query1" label="SQL Override in SQ " />

<node id="mapping_query2" label="SQL Override in lookup" />

<node id="mapping_query3" label="SQL Override" />

</node>

</root>

What do you mean exactly by "I want to find depth relative to the root node of XML"..?? Whether you are trying to find it relative to the root node of the highlighted xml above which is <node /> tag or else main root node which is the root for the whole xml <root />

Also you did not answer my question based on which attribute you want to know the depth of node..?? Is it based on name or id..??

If I were to write code to do this, I would start at the child item and go to its parent and its parent etc, counting how many times I did that, until I reached the root node. I'm assuming you start out knowing both the child node and the root node.