xmlDocument question

  • Thread starter Thread starter billsahiker
  • Start date Start date
B

billsahiker

How do I add <?xml version="1.0"?> to the beginning of an xmlDocument?
If I create an element node it adds an end tag. I read that the
xmlWriter class can do it, but that is a forward-only writer and I
need to look back to add certain attributes and values.

Bill
 
Use the CreateXmlDeclaration command... Like so:

Dim resultxml As New XmlDocument
Dim xmldec As XmlDeclaration = resultxml.CreateXmlDeclaration("1.0",
"UTF-8", "no")
resultxml.AppendChild(xmldec)

Hope that helps.
Dan.
 
Back
Top