Creating Text

In XML, the value of an element is the text contained between the start and end tags. Text can be stored in either of two ways in an XML document. The first is to store the text in a Text Node. This requires the actual text to obey the rules of XML and not have inappropriate characters in the text. For example, the text cannot contain less than (<) or greater than (>) characters. Otherwise, the XML document would not be well-formed and, therefore, would not load. The second way to store text is to place the text in a CDATA section in the XML document. CDATA sections safely support storing any free-formed text in an XML document.

The following Console application project example demonstrates each of these ways of storing text:

Get Visual Basic® .NET by Example 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.