如何将文本从多行textBox转换为XML [英] How can I convert the text from a multiline textBox into XML
本文介绍了如何将文本从多行textBox转换为XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在表单中我有一个多行textBox,在textBox中我只有文字,如下所示:
Inside a form I have a multiline textBox, in that textBox I have simply text, like this:
<VideoCard><brand id = '34' another = 'A'>PNY</brand><brand id = '43' other = 'B'>Gigabyte</brand></VideoCard>
当我按下一个按钮时,第一个textBox中的文本将显示在另一个这样的文本框中(带有标识和所有内容):
and when I press a button, the text inside the first textBox will show in another textBox like this (with the identation and all that):
<VideoCard>
<brand id = '34' another = 'A'>PNY</brand>
<brand id = '43' other = 'B'>Gigabyte</brand>
</VideoCard>
我怎样才能实现这一目标?
注意:我不能使用LINQ
How can I archieve that?
Note: I can't use LINQ
推荐答案
您可以使用richtextbox执行此操作。
尝试使用C#中的WinForms显示和过滤XML数据 [ ^
你可以即使在文本框中也显示缩进。但是,您需要自己提供缩进逻辑。
You could do this using a richtextbox.
Try Displaying and Filtering XML Data with WinForms in C#[^
You could display indentation even in a textbox. However, you need to provide the indentation logic yourself.
这篇关于如何将文本从多行textBox转换为XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文