scm0sml
asked on
problem deserialising an xml file
I have the following:
Private Function ConvertXMLToBDC(ByVal xmlPathFile As String) As BdcHandoffFile
Dim tmpBDC As New BdcHandoffFile
Dim deSerialiser As XmlSerializer
Dim xmlReader As New XmlTextReader(xmlPathFile)
deSerialiser = New XmlSerializer(typeof(tmpBD C))
tmpBDC = deSerialiser.Deserialize(x mlReader)
Return tmpBDC
End Function
I'm literally just trying to deserialise an xml file into an object.
I'm getting the error 'Is' expected at the line:
deSerialiser = New XmlSerializer(typeof(tmpBD C))
Private Function ConvertXMLToBDC(ByVal xmlPathFile As String) As BdcHandoffFile
Dim tmpBDC As New BdcHandoffFile
Dim deSerialiser As XmlSerializer
Dim xmlReader As New XmlTextReader(xmlPathFile)
deSerialiser = New XmlSerializer(typeof(tmpBD
tmpBDC = deSerialiser.Deserialize(x
Return tmpBDC
End Function
I'm literally just trying to deserialise an xml file into an object.
I'm getting the error 'Is' expected at the line:
deSerialiser = New XmlSerializer(typeof(tmpBD
ASKER
lol!!
ah soz.....im doing this for the first time and am ripping stuff of the net.
could you give a full vb.net example?
ah soz.....im doing this for the first time and am ripping stuff of the net.
could you give a full vb.net example?
Example of what?
Bob
Bob
ASKER
deserialising an xml file in vb.net 2.0
May I ask what the bigger picture is here? What is using this functionality?
Bob
Bob
ASKER
i will be receiving an object via a webservice.
at the moment tho i only have the serialised version of it in an xml file.
so i want to create the object using the xml so i can replicate receiving the object via the webservice and work with it from there.
at the moment tho i only have the serialised version of it in an xml file.
so i want to create the object using the xml so i can replicate receiving the object via the webservice and work with it from there.
So you have an object represented in an XML file, and you are trying to deserialize that object into a reference.
What is wrong with your code? Are you getting exceptions?
Bob
What is wrong with your code? Are you getting exceptions?
Bob
ASKER
Dim strDBname As String
Dim oReg As Microsoft.Win32.RegistryKe y
oReg = Microsoft.Win32.Registry.L ocalMachin e.OpenSubK ey("SOFTWA RE\Traveli nk\Configu ration")
strDBname = oReg.GetValue("TcatDatabas e")
Dim strQuoteID As String
Dim _bdcImportFile As New BdcHandoffFile
Dim _objTravelinkHandoff As New TravelinkHandoff
'_bdcImportFile = ConvertXMLToBDC(_pathToExa mpleBDCFil e)
strQuoteID = CStr(_objTravelinkHandoff. CreateQuot e(_bdcImpo rtFile))
MsgBox(strQuoteID)
gives me the error:
'Is' Expected
on line:
deSerialiser = New XmlSerializer(typeof(tmpBD C))
Dim oReg As Microsoft.Win32.RegistryKe
oReg = Microsoft.Win32.Registry.L
strDBname = oReg.GetValue("TcatDatabas
Dim strQuoteID As String
Dim _bdcImportFile As New BdcHandoffFile
Dim _objTravelinkHandoff As New TravelinkHandoff
'_bdcImportFile = ConvertXMLToBDC(_pathToExa
strQuoteID = CStr(_objTravelinkHandoff.
MsgBox(strQuoteID)
gives me the error:
'Is' Expected
on line:
deSerialiser = New XmlSerializer(typeof(tmpBD
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
deSerialiser = New XmlSerializer(GetType(tmpB
Bob