I have an app that needs to create xml files by extracting data from a database. I can do this fine.

I am using in my code...

Dim writer As New XmlTextWriter(Server.MapPath("test.xml"), Encoding.UTF8)

XmlTextWriter

writer.WriteStartDocument()

writer.WriteStartElement("TEST")

writer.WriteElementString("Items", "Item1")

and so on (for example)

The problem is when I need to create tags (elements) with Attributes

If I need to have an element ie.. <Country Language=English>Canada</Country>


Using the writer.WriteStartElement method gives me errors due to the spacing.

So how do I in asp.net create these tags/elements with spaces and add attributes. Do I use WriteStartElement or sommething else. Any help would be appreciated and an example of code if you can provide any!