POCKET PC -creating a file problem

G

Guest

I've deployed a custom app that scannes barcodes and appends them to an XML
file. if the XML file doesn't exist I want to be able to create it. However
I get a
PlatformNotSupportedException.

Is programatically creating documents not support? Is there an other way to
do it? Running into problems opening as well.

here's the code that I'm using

Shared sFilePath = "\My Documents\Business\"

Public Shared Sub Create(ByVal sMode As String)
'determine if file exists
Dim sFileName As String = sFilePath & sMode.ToLower & ".xml"
If Not File.Exists(sFileName) Then

Dim doc As New XmlDocument
Dim declaration As XmlDeclaration = doc.CreateXmlDeclaration("1.0",
"ISO-8859-1", "yes")
Dim root As XmlElement = doc.CreateElement("Mannington")
Dim childElement As XmlElement = doc.CreateElement(sMode.ToUpper)

doc.AppendChild(declaration)
doc.AppendChild(root)
Try
doc.Save(sFileName)
Catch e As Exception
MsgBox(e.Message)
End Try
End If
 
D

Daniel Moth

Please turn option strict On when writing VB code (under Project
Properties->Common Properties->Build).

In either case, the problem appears to be with the encoding:
Dim declaration As XmlDeclaration = doc.CreateXmlDeclaration("1.0",
"ISO-8859-1", "yes")

Maybe you can use UTF-8 instead of ISO-8859-1

Cheers
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top