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
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