学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

关于DOMDocument建立节点的问题

关于DOMDocument建立节点的问题

DIM tempdoc as DOMDocument
DIM root as IXMLDOMElement
DIM tempnode as IXMLDOMElement

Set tempdoc = NEW DOMDocument
set root = tempdoc.CreateElement("Personal")
set tempdoc.documentElement = root

set tempnode = tempdoc.CreateNode(NODE_ELEMENT, "Web", "")

请问CreateElement和CreateNode的区别是什么?
CreateNode有那些参数,谢谢!

TOP

XmlElement elem;
elem =XmlDocument.CreateElement("新元素的前缀","新元素的本地名称","新元素的命名空间URL");

Example:

XmlDocument doc = new XmlDocument();
string xmlData = "<book xmlns:bk='urn:samples'></book>";

doc.Load(new StringReader(xmlData));

// Create a new element and add it to the document.
XmlElement elem = doc.CreateElement("bk", "genre", "urn:samples");
elem.InnerText = "fantasy";
doc.DocumentElement.AppendChild(elem);

Console.WriteLine("Display the modified XML...");
doc.Save(Console.Out);


XmlNode elem = doc.CreateNode("新节点的XmlNodeType","新节点的限定名","新节点的命名空间URL");

Example:

//Create the XmlDocument.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +
"<title>Pride And Prejudice</title>" +
"</book>");

//Create a new node and add it to the document.
XmlNode elem = doc.CreateNode(XmlNodeType.Element, "price", null);
elem.InnerText = "19.95";
doc.DocumentElement.AppendChild(elem);

Console.WriteLine("Display the modified XML...");
doc.Save(Console.Out);

╭∩╮︶︿︶╭∩╮鄙视他! ---打劫!!!!! 把嘴拿过来让我亲亲!

TOP

发新话题