O'Reilly logo

Visual Basic® .NET by Example by Bob Donald, Gabriel Oancea

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

Creating Elements and Attributes

The most common items found in an XML document include elements and attributes. When creating a new XML document, the basic idea is that you instantiate a new System.Xml.XmlDocument object in memory and add instances of System.Xml.XmlElement to the document object. For each element, you can also define attributes that are represented as System.Xml.XmlAttribute object.

XmlElement objects can be added as children to other XmlElement objects, resulting in a nested structure. The final XML document contains data based on the code that generated the XML. This is typically dependant on the type of XML content your application is creating.

To show how this works exactly, create a new Console application project and add ...

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