Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Configurable XmlSerializer #19

Open
eFse7en opened this issue Nov 19, 2020 · 1 comment
Open

[Request] Configurable XmlSerializer #19

eFse7en opened this issue Nov 19, 2020 · 1 comment

Comments

@eFse7en
Copy link

eFse7en commented Nov 19, 2020

Hello, are there any plans to make the XmlSerializer configurable?

I am using flurl in integration tests, and currently I have to use my own extensions to make the XML de-serialization error sensitive:

public static XmlSerializer NewXmlSerializerWithErrorHandling<T>()
{
    var serializer = new XmlSerializer(typeof(T));
    serializer.UnknownAttribute += Serializer_UnknownAttribute;
    serializer.UnknownElement += Serializer_UnknownElement;
    serializer.UnknownNode += Serializer_UnknownNode;
    serializer.UnreferencedObject += Serializer_UnreferencedObject;
    return serializer;
}

On the other hand json de-serialization is configurable (even globally):

FlurlHttp.Configure(settings =>
{
    settings.BeforeCall = BeforeFlurlCall;
    settings.AfterCall = AfterFlurlCall;
    settings.OnError = OnFlurlError;
    settings.JsonSerializer = new NewtonsoftJsonSerializer(new JsonSerializerSettings
    {
        MissingMemberHandling = MissingMemberHandling.Error
    });
    //settings.XmlSerializer() = ...;
});
@lvermeulen
Copy link
Owner

Can you send a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants