Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
MicrosoftArticlesForumsFAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

WebArticlesForumsFAQs
JavaScript
ASP
ASP.NET
WCF

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Non-MicrosoftArticlesForumsFAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

Operating SysArticlesForumsFAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsFAQs
BizTalk
Site Server
Exhange Server
IIS

Graphic DesignArticlesForumsFAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web

OtherArticlesForumsFAQs
Lounge
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes

 

  View Other VB 6.0 Posts   Ask New Question  Ask New Question With Power Editor

xml header encoding declaration
bobby naderi posted at Tuesday, November 03, 2009 4:53 PM

building an xml generator in vb within excel, how can i get the encoding declaration to appear as the first line?

<?xml version="1.0" encoding="ISO-8859-1" ?>
Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0
re
Web star provided a rated reply to bobby naderi on Tuesday, November 03, 2009 10:26 PM

u can use WriteStartDocument for that encoding

also see this

http://support.microsoft.com/kb/317169

Reply    Reply Using Power Editor
  Rank Winnings Points
November 5 $55.00 143
October 10 $28.00 94

I guess the answer above points to VB.Net and not VB 6.0.
[)ia6l0 iii provided a rated reply to bobby naderi on Wednesday, November 04, 2009 1:33 PM

In VB 6.0, you would write the XML Declaration like this:

Dim memory_stream As New MemoryStream
Dim xmlTextWriter As New XmlTextWriter(memory_stream, System.Text.Encoding.UTF8)
' Write the XML declaration.
xmlTextWriter.WriteStartDocument(True)

And if you happen to migrate to VB.Net anytime,  you could use the XMLDocument class's CreateXmlDeclaration method. Sample snippet provided below.

//Create or Load the Xml Document.
XmlDocument xmlDoc = new XmlDocument();
//Create an XML declaration. 
XmlDeclaration xmlDeclartion = xmlDoc.CreateXmlDeclaration("1.0",null,null);
Reply    Reply Using Power Editor
  Rank Winnings Points
November 1 $217.00 560
October 1 $226.00 771