What i'm trying to do is to read an XML-file with orders into a list. Every order kan contain multiple orderlines.
For this i'm using the XML-parser and the following code.
When i execute the last three lines of code i get the following error:
"An error has occurred in sub: lm_ophalenversturen_pda_endelement (java line: 791) java.lang.ClassCastException: lm.mobile.android.main$_tregel Continue?"
At the end i try to add the complete fZending, with (multiple) fregel, to a list ArZendingen. If i remove the line "fZending.Zendingregels.Add(fregel)", it adds the fZending to arZendingen.
Can someone give me a direction?
For this i'm using the XML-parser and the following code.
B4X:
Type Tregel (regel_id As String, _
aantal As Int, _
eenheid As String)
Type TZending (zendingid As String, _
vrachtnr As String, _
barcode As String, _
A_naam As String, _
Zendingregels As List)
Dim arZendingen As List
Sub Process_Globals
Dim fZending As TZending
Dim fregel As Tregel
Dim iTeller As Int
End Sub
Sub PDA_EndElement (Uri As String, Name As String, Text As StringBuilder)
If Name = "z01" Then
fZending.BestelLijst = Text.ToString
End If
If Name = "z03" Then
fZending.zendingid = Text.ToString
End If
If Name = "z04" Then
fZending.vrachtnr = Text.ToString
End If
{and more}
....
If Name = "r01" Then
fregel.regel_id = Text.ToString
End If
If Name = "r02" Then
fregel.Aantal = Text.ToString
End If
If Name = "r03" Then
fregel.eenheid_id = Text.ToString
End If
{and more "r"}
....
If Name = "r" Then 'if XML-tag = "r" then add fregel to fZending
'*************
fZending.Zendingregels.Add(fregel) 'The programm gives an error on this line.
'*************
End If
If (Name = "z") Then 'zending toevoegen
Main.arZendingen.Add(fZending)
End If
End Sub
When i execute the last three lines of code i get the following error:
"An error has occurred in sub: lm_ophalenversturen_pda_endelement (java line: 791) java.lang.ClassCastException: lm.mobile.android.main$_tregel Continue?"
At the end i try to add the complete fZending, with (multiple) fregel, to a list ArZendingen. If i remove the line "fZending.Zendingregels.Add(fregel)", it adds the fZending to arZendingen.
Can someone give me a direction?
Last edited: