用xmldocument读取xml后  获取根节点document.FirstChild和获取根元素 document.DocumentElement有啥区别
同理 创建节点createNode和创建元素createElement有啥区别  xmlNode和xmlElement有啥区别晕死了 节点和元素有啥区别啊!!!!

解决方案 »

  1.   

    元素一定是节点,但节点不一定是元素,比如下面的备注节点。XmlDocument doc = new XmlDocument();
    XmlNode node = doc.CreateNode(XmlNodeType.Comment, "comment", null);
    bool b = node is XmlElement;       // false一个节点是不是XmlElement可以用XmlNodeType得知。
      

  2.   


    没明白......意思是备注节点是xmlNode但不是xmlElement ?
      

  3.   

    public   interface   Element   extends   Node
    所以说Element是Node的扩展,除了Element之外,Attribute(属性)、Text(文本节点)、PI(处理指令)、 Document(文档)等等都是Node。
    例如,用Element可以方便的获得Node的属性getAttribute(String attrName)
    如果用Node,可以得到一个属性集,还要进一步检索才可得到想要的属性。
      

  4.   

    元素一定是节点,但节点不一定是元素,比如下面的备注节点。C# codeXmlDocument doc = new XmlDocument();
    XmlNode node = doc.CreateNode(XmlNodeType.Comment, "comment", null);
    bool b = node is XmlElement;       // false
    ……一个节点是不是XmlElement可以用XmlNodeType得知。
      

  5.   

    DOM level 1 .  public interface Node
      {
        string getNodeName();
        // throws DOMException;
        string getNodeValue();
        // throws DOMException;
        void setNodeValue(string nodeValue);
        NodeType getNodeType();
        Node getParentNode();
        NodeList getChildNodes();
        Node getFirstChild();
        Node getLastChild();
        Node getPreviousSibling();
        Node getNextSibling();
        NamedNodeMap getAttributes();
        Document getOwnerDocument();
        // throws DOMException;
        Node insertBefore(Node newChild, Node refChild);
        // throws DOMException;
        Node replaceChild(Node newChild, Node oldChild);
        // throws DOMException;
        Node removeChild(Node oldChild);
        // throws DOMException;
        Node appendChild(Node newChild);
        bool hasChildNodes();
        Node cloneNode(bool deep);
      }
      public interface Element : Node
      {
        string getTagName();
        string getAttribute(string name);
        //throws DOMException;
        void setAttribute(string name, string value);
        //throws DOMException;
        void removeAttribute(string name);
        Attr getAttributeNode(string name);
        //throws DOMException;
        Attr setAttributeNode(Attr newAttr);
        //throws DOMException;
        Attr removeAttributeNode(Attr oldAttr);
        NodeList getElementsByTagName(string name);
        void normalize();
      }
      

  6.   

                XmlNode node;
                XmlElement element;
                element.SetAttribute("name", "value"); //可以添加属性
                node.SetAttribute("name", "value");    //报错 
      

  7.   

    这是我上网抄别人的。但我记得这个解释是对的。
    <?xml version="1.0" encoding="utf-8" ?>
    <phonebank>
      <gn nm="grdl" val="个人业务">
          <个人余额查询 val="0" nm="gryecx"></个人余额查询>
          <个人三日内查询 val="1" nm="grsricx"></个人三日内查询>
      </gn>
    </phonebank>
    其中<phonebank> <gn >  <个人余额查询 >   <个人三日内查询>都属于节点,节点是属性的开始,每个节点可能包含几个属性.如<个人余额查询>节点中的val和nm都是他的属性,"="后面是属性的值
      

  8.   

    html dom 在 ie 和 firefox,
    对于换行的解读也不同, 换行在 ff 中作为了一个 node.