簡體   English   中英

如何在C#中的innerXml中設置xmlTag?

[英]How to set xmlTag inside innerXml in c#?

我正在開發一個要求用行內的標簽替換特定單詞的應用程序。

例如考慮以下行

became an accomplished singer, musician, and hymn writer 1

1用一些文本替換,並且最終輸出應類似於下面的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>

我嘗試了以下代碼

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

但是仍然在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>

如何在xml中獲取所需的輸出。

這個帖子已經解決了這個問題

看一下HttpUtility.HtmlDecode

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM