XmlDocument.LoadXML+如何構造xml字串
阿新 • • 發佈:2019-01-22
tringBuilder sb = new StringBuilder();
sb.Append(" <?xml version=/"1.0/"?> ");
sb.Append(" <root> ");
sb.Append(" <test value=/"| /"/> ");
sb.Append(" </root> ");
XmlDocument d = new XmlDocument();
try
{
d.LoadXml(sb.ToString());
MessageBox.Show("OK");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
d = null;
sb = null;
}