Since we need to use C# for related programming recently, we have compiled the corresponding code. The following code is to access html and generate the treeview dom book code:
private void insertdomnodes(ihtmldomnode parentnode,treenode tree_node)
{
if(parentnode.haschildnodes())
{
ihtmldomchildrencollection allchild = (ihtmldomchildrencollection)parentnode.childnodes;
int length = allchild.length;
for(int i=0;i<length;i++)
{
ihtmldomnode child_node = (ihtmldomnode)allchild.item(i);
treenode tempnode = tree_node.nodes.add(child_node.nodename);
insertdomnodes(child_node,tempnode);
}
}
}
//Insert the domnode into
private void evipsbrowser_documentcomplete(object sender, axshdocvw.dwebbrowserevents2_documentcompleteevent e)
{
domtreeview.nodes.clear();
ihtmldocument3 htmldocument =(ihtmldocument3)evipsbrowser.document;
ihtmldomnode rootdomnode = (ihtmldomnode)htmldocument.documentelement;
treenode root = domtreeview.nodes.add("html");
insertdomnodes(rootdomnode,root);
}