Oh, got it, thank you!
About the possible solution: as I understand, it is possible that not only WS-Federation configuration could exist in uploaded .xml file together with SAML configuration, so we are not able to handle all possible solutions. In this case, what if we will not remove unnecessary information but will extract only SAML configuration and validate it.
And there is a question (I understand that this question is not related to the work of the library, for which I apologize in advance. I do not expect a full answer to this question, but I would be happy to take any advice): is there a way to extract information (part of xml) from xml which is connected only with SAML specification (possibly somehow it could be done using scheme, or only IDPSSODescriptor node should exist for ServicesProvider)?