C# 4.0 删除xml片段上的空白
是否可以在不使用LINQ的情况下删除下方xml标记之间的白色间隔C# 4.0 删除xml片段上的空白,c#-4.0,C# 4.0,是否可以在不使用LINQ的情况下删除下方xml标记之间的白色间隔 ?xml version="1.0"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
?xml version=“1.0”>
托弗
贾尼
提醒
这个周末别忘了我!
致:
ToveJaniReminderDon这个周末别忘了我!
您可以像这样使用正则表达式替换所有匹配的\s*
<?xml version="1.0"?><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>
System.Text.RegularExpressions.Regex.Replace("INPUT", ">\s*<", "><")