读书人

求帮忙~该怎么解决

发布时间: 2012-12-17 09:31:40 作者: rapoo

求帮忙~!
本帖最后由 lisiwen8 于 2012-11-26 15:43:08 编辑 对XML文件的编辑 文本框输入
<?xml version="1.0" encoding="ISO-8859-1"?>
<1><to>George</to><2><from>John</from><heading>Reminder</heading></2><body>Don't forget the meeting!</body></1>

点击编辑后文本框显示:
<?xml version="1.0" encoding="ISO-8859-1"?>
<1>
<to>George</to>
<2>
<from>John</from>
<heading>Reminder</heading>
</2>
<body>Don't forget the meeting!</body>
</1>

<1><2>代表标签
[最优解释]


private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = Regex.Replace(textBox1.Text, @"\x20*(</?\d+>
[其他解释]
</[a-zA-Z]+>)", "$1\r\n");
}


[其他解释]
引用:
C# code?



12345

private void button1_Click(object sender, EventArgs e) { textBox1.Text = Regex.Replace(textBox1.Text, @"\x20*(</?\d+>

读书人网 >C#

热点推荐