简体   繁体   中英

How to set xmlTag inside innerXml in c#?

I am working on an application in which requirement is to replace specific word with a tag inside a line.

For example consider following line

became an accomplished singer, musician, and hymn writer 1

1 is replace with some text and final output should be like as shown below in xml

     <ln coord="25.78:338.56:318.35:346.89" page="1" height="574.98" left="25.78" 
top="338.56" font="CrimsonText-Roman" fontsize="12.5" fonttype="Embeded">
        became an accomplished singer, musician, and hymn writer in 
    <footnote id='1'>1 </footnote> </ln>

I have tried following code

Line.InnerXml.Replace("&lt;", "<").Replace("&gt;", ">");

But still get the following output in xml

 <ln coord="25.78:338.56:318.35:346.89" page="1" height="574.98" left="25.78" 
    top="338.56" font="CrimsonText-Roman" fontsize="12.5" fonttype="Embeded">
            became an accomplished singer, musician, and hymn writer in 
        &lt;footnote id='1'&gt;1 &lt;/footnote&gt; </ln>

How to get required output in xml.

This problem was allready solved in this post

Look at HttpUtility.HtmlDecode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM