关于DOMDocument建立节点的问题
<P>DIM tempdoc as DOMDocument<BR>DIM root as IXMLDOMElement<BR>DIM tempnode as IXMLDOMElement<BR><BR>Set tempdoc = NEW DOMDocument<BR>set root = tempdoc.<FONT color=#1111ee>CreateElement</FONT>("Personal")<BR>set tempdoc.documentElement = root<BR></P><P>set tempnode = tempdoc.<FONT color=#1111ee>CreateNode</FONT>(NODE_ELEMENT, "Web", "")<BR><BR>请问CreateElement和CreateNode的区别是什么?<BR>CreateNode有那些参数,谢谢!</P>
<P> Example:</P>
<P>XmlDocument doc = new XmlDocument();<BR> string xmlData = "<book xmlns:bk='urn:samples'></book>";</P>
<P> doc.Load(new StringReader(xmlData));</P>
<P> // Create a new element and add it to the document.<BR> XmlElement elem = doc.CreateElement("bk", "genre", "urn:samples");<BR> elem.InnerText = "fantasy";<BR> doc.DocumentElement.AppendChild(elem);</P>
<P> Console.WriteLine("Display the modified XML...");<BR> doc.Save(Console.Out);</P>
<P><BR>XmlNode elem = doc.CreateNode("新节点的XmlNodeType","新节点的限定名","新节点的命名空间URL");</P>
<P>Example:</P>
<P>//Create the XmlDocument.<BR> XmlDocument doc = new XmlDocument();<BR> doc.LoadXml("<book genre='novel' ISBN='1-861001-57-5'>" +<BR> "<title>Pride And Prejudice</title>" +<BR> "</book>");</P>
<P> //Create a new node and add it to the document.<BR> XmlNode elem = doc.CreateNode(XmlNodeType.Element, "price", null);<BR> elem.InnerText = "19.95";<BR> doc.DocumentElement.AppendChild(elem); <BR> <BR> Console.WriteLine("Display the modified XML...");<BR> doc.Save(Console.Out);<BR></P>
页:
[1]
