What kind of menu? In NW04 there is only limited menu support, starting with NW04s you will get nested menus, menubars etc.
Generally, to create a UI element tree from structured data, e.g. XML:
- parse the data
- traverse the resulting data structure creating the target UI element structure in method wdDoModifyView()