Hi,
I have been trying to do this for a couple of days and failed.
I have a treeview written in java script.
The nodes are separated by the <DIV> tag.
Each <DIV> block is preceded with the "id" value for the parent tree node.
This is based on the PHP Layers Menu 3.0.2 dynamic PHP menu.
What I ultimately want to do is to scrape this and import it in a windows forms treeview control.
My first challenge is to parse out the tree nodes in such a way that I can keep track of each node's parent.
What is a suggested method to achieve this?
The value I want t extract is the name of the menu which precedes the </a> tags.
Here is the source code
I have been trying to do this for a couple of days and failed.
I have a treeview written in java script.
The nodes are separated by the <DIV> tag.
Each <DIV> block is preceded with the "id" value for the parent tree node.
This is based on the PHP Layers Menu 3.0.2 dynamic PHP menu.
What I ultimately want to do is to scrape this and import it in a windows forms treeview control.
My first challenge is to parse out the tree nodes in such a way that I can keep track of each node's parent.
What is a suggested method to achieve this?
The value I want t extract is the name of the menu which precedes the </a> tags.
Here is the source code
PHP:
<div class="treemenudiv" id="jt1"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><a onmousedown="toggletreemenu1( '1' );"><img border="0" align="top" alt="+" class="imgs" src="pic/tree_collapse_corner.png" id="jt1node"></a><img border="0" align="top" alt="O" class="imgs" src="pic/tree_folder_open.png" id="jt1folder"><a class="phplmnormal" id="jt1item" dao_id="4" onclick="javascript: { selectTreeNode( this ); }">Campus</a></div>
<div id="jt1son" style="display: block;" class="treemenudiv">
<div class="treemenudiv" id="jt2"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><a onmousedown="toggletreemenu1( '2' );"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_collapse.png" id="jt2node"></a><img border="0" align="top" alt="O" class="imgs" src="pic/tree_folder_open.png" id="jt2folder"><a class="phplmnormal" id="jt2item" dao_id="31" onclick="javascript: { selectTreeNode( this ); }">Office</a>
</div>
<div id="jt2son" style="display: block;" class="treemenudiv">
<div class="treemenudiv" id="jt3"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt="|" class="imgs" src="pic/tree_vertline.png"><img border="0" align="top" alt="T" class="imgs" src="pic/tree_split.png"><img border="0" align="top" alt="^" class="imgs" src="pic/tree_leaf.png"><a class="phplmnormal" id="jt3item" dao_id="34" onclick="javascript: { selectTreeNode( this ); }">Off1</a>
</div>
<div class="treemenudiv" id="jt4"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt="|" class="imgs" src="pic/tree_vertline.png"><img border="0" align="top" alt="T" class="imgs" src="pic/tree_split.png"><img border="0" align="top" alt="^" class="imgs" src="pic/tree_leaf.png"><a class="phplmnormal" id="jt4item" dao_id="35" onclick="javascript: { selectTreeNode( this ); }">Off2</a>
</div>
<div class="treemenudiv" id="jt5"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt="|" class="imgs" src="pic/tree_vertline.png"><img border="0" align="top" alt="T" class="imgs" src="pic/tree_split.png"><img border="0" align="top" alt="^" class="imgs" src="pic/tree_leaf.png"><a class="phplmnormal" id="jt5item" dao_id="36" onclick="javascript: { selectTreeNode( this ); }">lab</a>
</div>
<div class="treemenudiv" id="jt6"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt="|" class="imgs" src="pic/tree_vertline.png"><img border="0" align="top" alt="L" class="imgs" src="pic/tree_corner.png"><img border="0" align="top" alt="^" class="imgs" src="pic/tree_leaf.png"><a class="phplmnormal" id="jt6item" dao_id="37" onclick="javascript: { selectTreeNode( this ); }">reception</a>
</div>
</div>
<div class="treemenudiv" id="jt7"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><a onmousedown="toggletreemenu1( '7' );"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_collapse.png" id="jt7node"></a><img border="0" align="top" alt="O" class="imgs" src="pic/tree_folder_open.png" id="jt7folder"><a class="phplmnormal" id="jt7item" dao_id="32" onclick="javascript: { selectTreeNode( this ); }">WA</a>
</div>
<div id="jt7son" style="display: block;" class="treemenudiv">
<div class="treemenudiv" id="jt8"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt="|" class="imgs" src="pic/tree_vertline.png"><img border="0" align="top" alt="L" class="imgs" src="pic/tree_corner.png"><img border="0" align="top" alt="^" class="imgs" src="pic/tree_leaf.png"><a class="phplmnormal" id="jt8item" dao_id="38" onclick="javascript: { selectTreeNode( this ); }">Belveu</a>
</div>
</div>
<div class="treemenudiv" id="jt9"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><a onmousedown="toggletreemenu1( '9' );"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_collapse.png" id="jt9node"></a><img border="0" align="top" alt="O" class="imgs" src="pic/tree_folder_open.png" id="jt9folder"><a class="phplmnormal" id="jt9item" dao_id="33" onclick="javascript: { selectTreeNode( this ); }">SA</a>
</div>
<div id="jt9son" style="display: block;" class="treemenudiv">
<div class="treemenudiv" id="jt10"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt="|" class="imgs" src="pic/tree_vertline.png"><img border="0" align="top" alt="L" class="imgs" src="pic/tree_corner.png"><img border="0" align="top" alt="^" class="imgs" src="pic/tree_leaf.png"><a class="phplmnormal" id="jt10item" dao_id="39" onclick="javascript: { selectTreeNode( this ); }">Control Room</a>
</div>
</div>
<div class="treemenudiv" id="jt11"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt="T" class="imgs" src="pic/tree_split.png"><img border="0" align="top" alt="^" class="imgs" src="pic/tree_leaf.png"><a class="phplmnormal" id="jt11item" dao_id="41" onclick="javascript: { selectTreeNode( this ); }">Single</a>
</div>
<div class="treemenudiv" id="jt12"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><a onmousedown="toggletreemenu1( '12' );"><img border="0" align="top" alt="+" class="imgs" src="pic/tree_collapse_corner.png" id="jt12node"></a><img border="0" align="top" alt="O" class="imgs" src="pic/tree_folder_open.png" id="jt12folder"><a class="phplmnormal" id="jt12item" dao_id="42" onclick="javascript: { selectTreeNode( this ); }">Double</a>
</div>
<div id="jt12son" style="display: block;" class="treemenudiv">
<div class="treemenudiv" id="jt13"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt=" " class="imgs" src="pic/tree_space.png"><img border="0" align="top" alt="L" class="imgs" src="pic/tree_corner.png"><img border="0" align="top" alt="^" class="imgs" src="pic/tree_leaf.png"><a class="phplmnormal" id="jt13item" dao_id="43" onclick="javascript: { selectTreeNode( this ); }">Foo</a>
</div>
</div>
</div>