Expand tree upto the selected item

when dhtmlxTree is opened, how to expand the tree upto the preselected item in the tree?

To close all items in the tree:
tree.closeAllItems();

To expand the tree upto the preselected item in the tree:
tree.selectItem(tree.getSelectedItemId())

thanks for the reply. But I have

tree.enableSmartXMLParsing(true); set. so this does not seem to be working.

Please check the post
viewtopic.php?f=3&t=19703&p=62339#p62339