Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reading XML Document - Receiving Error
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Reading XML Document - Receiving Error
Divers
Thread ID:
00829956
Message ID:
00829956
Vues:
68
I'm trying to read in an XML document (posted below) right into a class object (also posed), but I keep getting an error saying there is an error in the XML document(2,2). Hoping someone can see what I'm doing wrong.

XML Document
<?xml version="1.0" standalone="yes"?>
<Settings>
 <iface>3</iface>
 <sendip>66.93.215.8</sendip>
 <sendport>14052</sendport>
 <mode>L</mode>
 <dlltouse>ctdft.msgdftp03.1</dlltouse>
 <starfac/>
 <timermin>10</timermin>
 <sendingapp>CQI</sendingapp>
 <facid>555</facid>
 <sendfacid/>
 <faccode/>
 <hbtmin>25</hbtmin>
</Settings>
WorkstationSettings Class
Public Class WorkstationSettings

    ' Internal fields for storing the data
    Private _iFace As Integer
    Private _SendIP As String
    Private _SendPort As Integer
    Private _mode As String
    Private _Dlltouse As String
    Private _StarFac As String
    Private _TimerMin As Integer
    Private _SendingApp As String
    Private _FacID As String
    Private _SendingFacID As String
    Private _FacCode As String
    Private _HBTMIN As Integer


    ' Public Properties for exposing the data

    Public Property iFace() As String
        Get
            Return _iFace
        End Get
        Set(ByVal Value As String)
            _iFace = Value
        End Set
    End Property

    Public Property SendIP() As String
        Get
            Return _SendIP
        End Get
        Set(ByVal Value As String)
            _SendIP = Value
        End Set
    End Property

    Public Property SendPort() As Integer
        Get
            Return _SendPort
        End Get
        Set(ByVal Value As Integer)
            _SendPort = Value
        End Set
    End Property

    Public Property Mode() As String
        Get
            Return _mode
        End Get
        Set(ByVal Value As String)
            _mode = Value
        End Set
    End Property
    Public Property DLLToUse() As String
        Get
            Return _Dlltouse
        End Get
        Set(ByVal Value As String)
            _Dlltouse = Value
        End Set
    End Property
    Public Property STARFAC() As String
        Get
            Return _StarFac
        End Get
        Set(ByVal Value As String)
            _StarFac = Value
        End Set
    End Property
    Public Property TimerMin() As Integer
        Get
            Return _TimerMin
        End Get
        Set(ByVal Value As Integer)
            _TimerMin = Value
        End Set
    End Property
    Public Property SendingApp() As String
        Get
            Return _SendingApp
        End Get
        Set(ByVal Value As String)
            _SendingApp = Value
        End Set
    End Property
    Public Property FacID() As String
        Get
            Return _FacID
        End Get
        Set(ByVal Value As String)
            _FacID = Value
        End Set
    End Property
    Public Property SendingFacID() As String
        Get
            Return _SendingFacID
        End Get
        Set(ByVal Value As String)
            _SendingFacID = Value
        End Set
    End Property
    Public Property FacCode() As String
        Get
            Return _FacCode
        End Get
        Set(ByVal Value As String)
            _FacCode = Value
        End Set
    End Property
    Public Property hbtmin() As Integer
        Get
            Return _HBTMIN
        End Get
        Set(ByVal Value As Integer)
            _HBTMIN = Value
        End Set
    End Property


End Class
Code in my Form Load that causes error:
       ' Create an object to hold the settings based on the WorkstationSettings Class
        Dim Settings As New WorkstationSettings()

        ' Create an XmlSerializer object to perform the reading and writing of the XML file
        Dim mySerializer As XmlSerializer = New XmlSerializer(GetType(WorkstationSettings))

        ' Read the settings from the XML file:

        ' Open the XML file
        Dim myFileStream As FileStream = New FileStream("ctdft.xml", FileMode.Open)
        ' Read the XML file and copy the contents directly to the object that holds the settings
        Settings = mySerializer.Deserialize(myFileStream)  '<=== This line bombs.
        ' Don't forget to close the file!
        myFileStream.Close()
Thanks for any help
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform