private void removeComment( XmlNode parent ) { XmlNode node = parent.FirstChild; while( node != null ) { XmlNode nextNode = node.NextSibling; if( node.NodeType == XmlNodeType.Comment ) { parent.RemoveChild(node); } else { removeComment(node); } node = nextNode; } } private void Form1_Load(object sender, System.EventArgs e) { const string xmlns = "http://www.atmarkit.co.jp/xmlns/sample/person"; XmlDocument document = new XmlDocument(); document.Load(@"c:\sample.xml"); removeComment(document); XmlNodeList ageList = document.GetElementsByTagName("age", xmlns); foreach( XmlNode ageNode in ageList ) { ageNode.InnerText = (int.Parse(ageNode.InnerText) + 1).ToString(); } XmlNodeList addressList = document.GetElementsByTagName("address", xmlns); for( int i=0; i