You can use the XMLTextWriter class to create XML content that uses a namespace. The code lies used to illustrate the idea are taken from the article How to use XMLTextWriter to create an XML document in VB.NET, and you can find more information about XML namespaces from the article How to use XML Namespaces in XML document.

The XmlTextWriter includes an overloaded version of the WriteStartElement() method that accepts a namespace URI. Here’s how it works:

Dim Ns as String = “https://www.Books.com/BooksList”

W.WriteStartDocument()

W.WriteStartElement(“BooksList”, Ns)

‘ Write the first book.

W.WriteStartElement(“Book” , Ns)