C#:Introduction to DOM Tutorial

From Progzoo
Jump to: navigation, search
The file http://progzoo.net/bbc.xml is as shown:
 <region id='Europe'>
  <country id='de' name='Germany' pop='82000000'/>
  <country id='fr' name='France'  pop='60000000'/>
 <region id='Asia'>
  <country id='cn' name='China' pop='1300000000'/>

This this tutorial we look at the following members of the DOM interface


FirstChild NextSibling

The program shown uses FirstChild and NextSibling to print the id of the first child of the second child node.

Change the program so that it prints the id of the second child of the first child.

[Font] [Default] [Show] [Resize] [History] [Profile]


Print the id and the name and the pop for the element e

[Font] [Default] [Show] [Resize] [History] [Profile]


The method ParentNode returns an XmlNode - you can 'cast' that to an XmlElement

Print the id and the id of the parent of element e

[Font] [Default] [Show] [Resize] [History] [Profile]