XML files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,

I have an application which set dataset object to xml file by using the
dataset.WriteXml function.

After this my application need to load those files back only if the first
node as a predifined identification text. For that I use the following code :

====>
For idx = 0 To sFile.GetUpperBound(0)
docElem.Load(Me.m_sFilePath & "\" & Name & "\" & sFile(idx))
If docElem.DocumentElement.Name.ToString <> Name Then
sTempFile(idx).Remove(1, Len(sTempFile(idx)))
End If
Next

<===

sFile string array contains the full qulified path to xml file name

THis works fine as long as my application have generated those file. Then
juste for testing I have open an XML file with note pad or inside VS 2003 and
modified the first node of the text, then save this file to an other xml file

At this time when I try to double click on the file to open it insoide
explorer, I get a syntax error, sounds like the simple fact of sving it back
after manually modiying it, corrupt the file.

Any idea ?

regards
serge
 
Hi Serge,

I'm not 100% sure that this is your problem, but I have had problems in
the past where the encoding is specified in the xml declaration, but
doesn't match the actual encoding of the file in question. By default,
notepad saves files with an ANSII. On the Save As... dialog you can
choose the encoding. On the Save As dialog in visual studio, there's a
little dropdown arrow on the Save button which lets you select "Save
with Encoding..." to let you choose what encoding you want to save the
file with.
 
Back
Top