Search code examples
c#htmlxmlxmltextreader

C# XmlTextReader: html entity replace


I have xml file with TAG like this:

<Question>dzia&amp;#322;owa</Question>

I'm reading this file using XmlTextReader and for this TAG I get something like this:

dzia&#322;owa

How to replace html entity numbers inside my xml to get something like this: "działowa"?


Solution

  • The only HTML entity in your sample is &amp;. You've then got some normal text that says #322;. You either want

    <Question>dzia&amp;&#322;owa</Question>
    

    which would give "dzia&łowa" (probably not what you want)

    or

    <Question>dzia&#322;owa</Question>
    

    which would give "działowa"