Dear Bilal,
To extract information from element first need to understand relationship. Relationship between wall, door and Room
Door Has Room(From Room and ToRoom)
Door Has Wall (As Host Element).
Your issue will be solved by more than one way.
1. You can use this relationship to make a list and retrieve information of Room according to wall.
2. Use bounding box of wall and find all room which is intersect to wall and make it distinct. But this will not work properly when your project have curved wall. For curved wall issue you have to get room information from its connected wall.
I hope this logic will help solve your issue.