Check out this thread: How to iterate through component via .NET(such as C#, in DxD or XDx)
It does not specifically pick out composite symbols, but the easy way to do that is make a separate list of reference designators from each component and key off the ones that are repeated.
In my previous post, I misunderstood the issue. I was thinking of fractured or multi-gate symbols when you said composite. In your recent post I think you are on the right track.