Best practices for accessing markup structure?


I’m messing around with some CodeIntel / Method Tree kind of stuff, and I’m having a rough time trying to parse out different grammar types (method, variable, etc…)

Does anyone know the best practice on how one would access or parse the markup in the currently active pane?