XML Object

XML Content vs Children

 
This article explains the often misunderstood difference between an XML node’s Content and it’s child nodes. The child nodes are not included in the node’s Content property. For example, here is a sample XML document:
 
<root><node1> node_value1 </node1><node2>
     <subnode1> subnode_value1 </subnode1>
     <subnode2> subnode_value2
          <subsubnode1> subsubnode_value1 </subsubnode1>
          <subsubnode2> subsubnode_value2 </subsubnode2>
          <subsubnode3> subsubnode_value3 </subsubnode3>
     </subnode2>
     <subnode3> subnode_value3 </subnode3>
     <subnode4> subnode_value4 </subnode4>
</node2><node3> node_value7 </node3></root>
 
node1 has no children, but its Content is "node_value1".
 
node2 on the other hand, has no Content, but it has four children.
 
subnode2 has both Content and children. Its Content = "subnode_value2", and it has 3 children.