Creating XmlElements

To create an XmlElement, the XmlDocument provides the CreateElement methods. The methods create an XmlElement node with the specified name and an optional namespace. This code illustrates how to create an element:

C#
XmlElement newElement = xmlDoc.CreateElement("Book");

VB
Dim newElement As xmlDoc.CreateElement("Book")

Get Microsoft® .NET Compact Framework Kick Start now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.