O'Reilly logo

Microsoft® .NET Compact Framework Kick Start by Ronnie Yates, Erik Rubin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Removing XmlAttributes from their XmlElements

The API for removing attributes is much richer than that for removing other nodes. This is due to the ability to remove nodes through methods on the XmlAttributeCollection class as well as methods on the XmlElement class.

The XmlAttributeCollection class provides three methods for removing an XmlAttribute: Remove, RemoveAt, and RemoveAll. The Remove method removes a single specified attribute from the attribute collection. The RemoveAt method removes a single attribute corresponding to the specified index from the collection. The RemoveAll method removes all of the attributes in the collection. Listing 11.28 demonstrates how to use each method.

Listing 11.28.
 C# XmlDocument doc = new XmlDocument(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required