import pyparsing as pp
text = """///<summary>
/// foobar
///</summary>
blah blah
///<summary> /// bar ///</summary>
///<summary>  ///<summary> /// baz  ///</summary> ///</summary>    
"""
comment = pp.nestedExpr('///<summary>', '///</summary>')
for match in comment.searchString(text):
    pass
pyparsing — парсить xml-комментарий