全局变量m_xDoc
我有属性(property)
public XmlDocument xDoc
{
get {return m_xDoc; }
set {value = m_xDoc; }
}
string xml = "<head><body><Inner> welcome </head></Inner><Outer> Bye</Outer></body></head>"
现在我必须将这个字符串设置为 XML 文档的属性......请指导我如何做
最佳答案
使用XmlDocument的LoadXml方法;
string xml = "<head><body><Inner> welcome </head> </Inner> <Outer> Bye</Outer></body></head>";
xDoc.LoadXml(xml);
关于c# - 如何使用 C# 将字符串转换为 XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10946888/