Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private xmlparser As Map
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub Button1_Click
'xui.MsgboxAsync("Hello world!", "B4X")
Dim xm As Xml2Map
xm.Initialize
xmlparser=xm.Parse(File.ReadString(File.DirAssets,"books.xml"))
Dim catalog As Map=xmlparser.Get("catalog")
Dim book As List=catalog.Get("book")
For Each bookdet As Map In book
' Dim authname As String=bookdet.Get("author")
' Dim price As String=bookdet.Get("price")
' Dim genre As String=bookdet.Get("genre")
' Log("The Author is : " & authname & " Price is : " & price & " , Catagory is : " & genre )
Dim attr As Map=bookdet.Get("Attributes")
Dim id As String=attr.Get("id")
Dim authname As String=bookdet.Get("author")
Dim price As String=bookdet.Get("price")
Dim genre As String=bookdet.Get("genre")
Log("Book ID: " & id & " Author is : " & authname & " Price is : " & price & " , Catagory is : " & genre )
Next
' Dim jg As JSONGenerator
' jg.Initialize(xmlparser)
' Log(jg.ToPrettyString(4))
End Sub