Skip to content

Send !DOCTYPE inside XML content using Refit #1759

Closed Answered by HeinPauwelyn
HeinPauwelyn asked this question in Q&A
Discussion options

You must be logged in to vote

Found a solution IHttpContentSerializer, maybe not the best one but it's working.

public class XmlDocTypeContentSerializer : IHttpContentSerializer
{
    /// <summary>Original XmlContentSerializer from Refit but without a possibility to add a !DOCTYPE.</summary>
    private readonly XmlContentSerializer _xmlContentSerializer;

    public XmlContentSerializerSettings ContentSerializerSettings { get; init; }

    public XmlDocTypeContentSerializer() : this(new())
    { }

    public XmlDocTypeContentSerializer(XmlContentSerializerSettings settings)
    {
        // No settings to process DTD or !DOCTYPE on writing... :-(
        settings.XmlReaderWriterSettings.ReaderSettings.DtdProcessing =

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by HeinPauwelyn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant