What's the difference between an element and a node in XML?

前端 未结 13 1703
清酒与你
清酒与你 2020-11-28 00:57

I\'m working in Java with XML and I\'m wondering; what\'s the difference between an element and a node?

13条回答
  •  野性不改
    2020-11-28 00:59

    As described in the various XML specifications, an element is that which consists of a start tag, and end tag, and the content in between, or alternately an empty element tag (which has no content or end tag). In other words, these are all elements:

     stuff 
    
    
    

    Though you hear "node" used with roughly the same meaning, it has no precise definition per XML specs. It's usually used to refer to nodes of things like DOMs, which may be closely related to XML or use XML for their representation.

提交回复
热议问题