I am just trying to get to grips with XML using the DOMDocument and related objects in Visual Basic 6.0

I've managed to create an XML document based on a recordset returned from an Access database using ADO.

I cycle thru the recordset adding the records using the various append methods and then call xmlDoc.Save. My xml document ends up in the form...

<data>
<record ID="1" LName="Hobson" FName="Graham"</record>
<record ID="2" LName="Smith" FName="John"</record>
</data>

I have two questions: -

1. How do I get the <?xml version="1.0"?> line to appear at the beginning of the file as it always is in the help file examples.

2. When I open the file in IExplorer the layout is as above (OK). However when I open it in Notepad (for instance to edit directly) the file is not layed out like this but is one long textstream i.e.

<data><record ID="1" LName="Hobson" Name="Graham"</record><record ID="2" LName="Smith" FName="John"</record></data>

When I open other XML files in Notepad they have the same alyout as the IExplorer version. Why is this?

If anyone can help I would be grateful. Thanks.

PS The first example is indented at the record level but I don't think it displays correctly on here.