-1
我有XLM,看起來像(長度278個字符):如何減少用於存儲在數據庫中的XML字符串長度?
<AppList>
<App>
<Info1>Value 1</Info1>
<Info2>Value 2</Info2>
<Info3>Value 3</Info3>
<AppList>
<App>
<Info1>Value 4</Info1>
<Info2>Value 5</Info2>
<Info3>Value 6</Info3>
</App>
</AppList>
</App>
</AppList>
對於數據庫存儲,我希望它看起來像(長度192個字符):
<AppList><App><Info1>Value 1</Info1><Info2>Value 2</Info2><Info3>Value 3</Info3><AppList><App><Info1>Value 4</Info1><Info2>Value 5</Info2><Info3>Value 6</Info3></App></AppList></App></AppList>
在記事本++他們有像Linearize XML
這樣做的工作。
有沒有辦法在C#中以編程方式做到這一點?
的可能的複製[C#/ XSLT:線性化XML部分工作碼(http://stackoverflow.com/questions/15131542/c-xslt-linearizing-xml-partially-working-code) –
@MohitShrivastava建議的副本沒有好的答案 – Toshi
'Regex.Replace(xmlString,@「> \ s + <", "><」)''。可能有一些邊緣案例可能會有問題。 –