I think this will work for you.
sed '/--#else--/,/--#endif--/{//!d}' test.xml
this will delete the lines between elseandendif
if you want to remove elseand endifalso use this:
sed '/--#else--/,/--#endif--/d' test.xml
in the case mentioned in the comments, try the following:
sed -n '/--#else--/,/--#endif--/p' test.xml
-n , /p /!d