System.Xml.Linq 命名空间
https://docs.microsoft.com/zh-cn/dotnet/api/system.xml.linq?view=netframework-4.8
Visual Basic 中的 XML
https://docs.microsoft.com/zh-cn/dotnet/visual-basic/programming-guide/language-features/xml/
Imports System.Xml.Linq.XElement
‘窗体上添加一个RichTextBox控件
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myString = "Embedded string variable data."
'XML 文本和 XML 轴属性不可用。请添加对 System.Xml、System.Xml.Linq 和 System.Core 的引用。
'查了N个小时终于搞明白需引用System.Xml.Linq.XElemen空间
Dim myXmlElement = _
<AnXmlNode attribute="1">
This is formatted text.
Embedded carriage returns will be kept.
These lines will print seperately.
Whitespace will also be maintained.
<%= myString %>
</AnXmlNode>
RichTextBox1.Text = myXmlElement.ToString() & Environment.NewLine & Environment.NewLine
RichTextBox1.Text &= myXmlElement.Value.ToString()
End Sub
End Class