Hi,
根据我的了解,Html里面的节点就是固定的几种,添加Html你可以使用这个方法来添加。
HtmlNodediv=doc.CreateElement("div");myNode.Append(div);
如果你是想对xml针对操作,方法有两种。
XmlNode.InsertAfter Method 和 XmlNode.AppendChild Method。
下面是我测试的代码,希望对你有帮助。
XmlDocument doc = new XmlDocument();
doc.LoadXml("" +
"
Pride And Prejudice" +"");
XmlNode root = doc.DocumentElement;
//Create a new node.
XmlElement elem = doc.CreateElement("p");
elem.InnerText = "19.95";
//Add the node to the document.
root.InsertAfter(elem, root.FirstChild);
Console.WriteLine("Display the modified XML...");
doc.Save(Console.Out);
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints
to MSDN Support, feel free to contact MSDNFSF@microsoft.com.