2 Replies Latest reply on Sep 29, 2009 11:05 AM by scuba_diver_steve

    Searching XML e4x

    scuba_diver_steve Level 1

      I have an Elixir ILOG OrgChart and am trying to traverse the tree to find a specific node and then add children to it.  I am trying to search using the .. operator and filters.  Is this possible?  I have XML that looks something like:

       

      <person id="12345" name="John Smith" address=... >

           <employee id="23456" name="Jane Doe" address=... />

           <employee id="34567" name="Jane Smith" address="...>

                <employee id="98765" name="Frank Sinatra" address=.../>

           </employee>

           <employee ie="45678" name="Frank Zappa" address=.../>

      </person>

       

      I access the tree using two different ways for searching:

       

       

      1. var collection:IHierarchicalCollectionView = chart.dataProvider as IHierarchicalCollectionView;

      2. var treeData:XML = XML(chart.currentRoot);

       

       

      To search for employee with the id 98765 I am using:

       

      var id:int = 98765

      collection..employee.(@id==id);

      treeData..employee.(@id==id);

       

      My goal is to be able to search the entire tree and get any node back that I want.  All the ids are unique.  I can use those as an index when searching the tree to return one unique node.