我在我的Doc變量中獲得了一個XMLDocument, 我需要將它顯示給用戶。在C#中顯示一個XML#
XmlDocument Doc = new XmlDocument();
Doc.LoadXml(dataGridView1.SelectedCells[0].Value.ToString())
是否有像Doc.show()這樣的函數?
我在我的Doc變量中獲得了一個XMLDocument, 我需要將它顯示給用戶。在C#中顯示一個XML#
XmlDocument Doc = new XmlDocument();
Doc.LoadXml(dataGridView1.SelectedCells[0].Value.ToString())
是否有像Doc.show()這樣的函數?
您可以通過設置使用XMLDocument對象的OuterXML屬性多行TextBox的Text屬性顯示XMLDocument對象的XML,例如,。
var xmlDocument = new XmlDocument();
xmlDocument.Load(@"C:\path\to\xmlFile.xml");
// For display on the console...
Console.WriteLine("XML: " + xmlDocument.OuterXML);
// For display in a WinForms TextBox control...
var text = new TextBox();
text.MultiLine = true;
text.Text = xmlDocument.OuterXML;
你可以,當然,使用您選擇呈現XML內容的不同的控制或表現層技術,但我只不過是給了這個的WinForms TextBox控件例如用於說明目的。
你打算如何顯示XML?您是否使用WinForms,WPF,控制檯應用程序?等 –