I have been studying the XmlSax and found a forum link by SpaceCow.
http://www.b4x.com/forum/basic4android-updates-questions/20246-xmlsax-read-sublist.html
I made the program with B4A and it works fine. However, on studying it in detail I got lost with the Scope of the Objects used in Erol's example.
Documentation says:
The tempDay Local variable in Sub Parser_StartElement is Dimmed and added the the global MyDays List.
After leaving the Sub Parser_StartElement the scope of the tempDay Local var is gone...
Though in the Sub Parser_EndElement the Text for the Elements is assigned to the tempDay GLOBAL variable.
I do not understand how this then gets into the MyDays List as tempDay (global) is not assigned to an item in MyDays.
Could someone explain how the data gets into the tempDay Local Variable which was added to the MyDay list??
:sign0104:
http://www.b4x.com/forum/basic4android-updates-questions/20246-xmlsax-read-sublist.html
I made the program with B4A and it works fine. However, on studying it in detail I got lost with the Scope of the Objects used in Erol's example.
Documentation says:
Scope
Variables that are declared in Sub Globals or Sub Process_Globals are global and can be accessed from all subs.
Other variables are local and can only be accessed from the sub that they are declared in.
The tempDay Local variable in Sub Parser_StartElement is Dimmed and added the the global MyDays List.
After leaving the Sub Parser_StartElement the scope of the tempDay Local var is gone...
B4X:
If Name = "day" Then
Dim tempDay As Day 'this creates a new Day object
tempDay.Initialize
tempDay.Activities.Initialize
MyDays.Add(tempDay)
Though in the Sub Parser_EndElement the Text for the Elements is assigned to the tempDay GLOBAL variable.
I do not understand how this then gets into the MyDays List as tempDay (global) is not assigned to an item in MyDays.
Could someone explain how the data gets into the tempDay Local Variable which was added to the MyDay list??
:sign0104:
Last edited: