According to the DOM, everything in an XML document is a node.
The DOM says:
- The entire document is a document node
- Every XML element is an element node
- The text in the XML elements are text nodes
- Every attribute is an attribute node
- Comments are comment nodes
Example :
<Bollywood> <Movie name="RaOne"> Going to release in Dec 2011 <Actor> Shahrukh Khan </Actor> <Production> Red Chilly </Production> </Movie> </BollyWood>
As shown in above example and image:
- Parent Element name is “Movie”.
- This Element have attribute, which is “name” and attribute has a value “RaOne”.
- This Element has a text “Going to release in Dec2011″ which is Text Node.
- The element has two child nodes: Actor and Production which are known as Element Node.
- Element “Actor” has text node “Sharukh Khan” and Element “Production” has text node “Red Chilly”.
Leave a Reply