日期:2014-05-18 浏览次数:21102 次
<!DOCTYPE Category [ <!ELEMENT Category ANY> <!ELEMENT Item EMPTY> <!ATTLIST Category id ID #REQUIRED> <!ATTLIST Category name CDATA #IMPLIED> <!ATTLIST Category comment CDATA #IMPLIED> <!ATTLIST Category text CDATA #IMPLIED> <!ATTLIST Category count CDATA #IMPLIED> <!ATTLIST Item id ID #REQUIRED> <!ATTLIST Item name CDATA #IMPLIED> <!ATTLIST Item count CDATA #IMPLIED> ]> <Category id="10000"> <Category id="11000"> </Category> </Category>
XmlElement element = doc.CreateElement("ITEM", doc.NamespaceURI); element.SetAttribute("id", id); element.SetAttribute("name", name); element.SetAttribute("text", name); parent.AppendChild(element); doc.getElementById(id); //这里返回null