我有一个字符串 [XML],我想找到包含一个词的标签并将该标签替换为另一个名称。
我试过使用这个,但没有成功:
var regex = new Regex(@"\bKeyValueOfstringOutcome\b", RegexOptions.IgnoreCase);
string result = regex.Replace(xml.Document.ToString(), "");
这是我的 XML:
<Response>
<Outcome>
<KeyValueOfstringOutcomeTest1>
<Key>Icon</Key>
<Value>
<DataType>System.String</DataType>
<Field>Icon</Field>
<Value>O</Value>
</Value>
</KeyValueOfstringOutcomeTest1>
<KeyValueOfstringOutcomeTest2>
<Key>IconDescription</Key>
<Value>
<DataType>System.String</DataType>
<Field>IconDescription</Field>
<Value>Old</Value>
</Value>
</KeyValueOfstringOutcomeTest2>
<KeyValueOfstringOutcomeTest3>
<Key>IconLongDescription</Key>
<Value>
<DataType>System.String</DataType>
<Field>IconLongDescription</Field>
<Value>Older</Value>
</Value>
</KeyValueOfstringOutcomeTest3>
</Outcome>
</Response>
我需要找到包含 KeyValueOfstringOutcome 的节点,并将 KeyValueOfstringOutcomeTest1、KeyValueOfstringOutcomeTest2、KeyValueOfstringOutcomeTest3 替换为 KeyValueOfstringOutcome。
米脂
千万里不及你
临摹微笑
MMMHUHU
泛舟湖上清波郎朗
相关分类