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

Inserting XmlAttributes into an XmlDocument

XmlAttributes can be inserted into a document by using the SetAttribute method described earlier in this chapter. Alternatively, you can add them using the insertion methods on the XmlAttributeCollection class. The insertion methods, similar to the XmlNode insertion methods, are Append, Prepend, InsertBefore, and InsertAfter.

Append and Prepend add an XmlAttribute to the end of the attribute list and to the beginning of the attribute list, respectively. The methods return the XmlAttribute that was inserted. If there exists an attribute in the collection with the same name, then the original attribute is removed from the collection, and the new attribute is added. Listing 11.23 illustrates how to use ...

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