Private parser As SaxParser
Private SubParser As SaxParser
Sub Button1_Click()
Dim j As HttpJob
j.Initialize("j",Me)
j.Username = "garym"
j.Password = "xxxxxxx"
j.Download("https://10.10.10.111:8443/api/rest/active-calls")
Wait for (j) JobDone (j As HttpJob) 'Query server, use Wait to process each of the returning xml entries
If j.Success Then
Log(j.GetString.Length)
If j.GetString.Length > 500 Then
parser.Parse(StringToInputStream(j.GetString), "Parser")
Else
TableView1.Items.Clear
NoActiveCalls("")
End If
End If
j.Release
' Here we look for the "link" entry
Sub Parser_StartElement (URI As String, Name As String, Attributes As Attributes)
Select Case Name
Case "link"
If (Attributes.GetValue2("", "title") = "Call Info") Then
SubParsarCall("", Attributes.GetValue2("", "href")) 'When link is found, query again with new link'
End If
End Select
End Sub
'Query with Link information
Sub SubParsarCall (Which As String, linkstring As String)
Dim j1 As HttpJob
j1.Initialize("", Me2)
j1.Username = "garym"
j1.Password = "xxxxxxx"
j1.Download(linkstring)
Wait for (j1) JobDone (j1 As HttpJob) 'This is where it jumps to 'Parser_StartElement instead of SubParserCall_StartElement'
If j1.Success Then
Log("SPC:" & j1.GetString.Length)
If j1.GetString.Length > 500 Then
SubParser.Parse(StringToInputStream(j1.GetString), "SubParser")
Log(j1.GetString)
Else
Log("No Active Calls")
TableView1.Items.Clear
End If
End If
j1.Release
End Sub
Sub SubParser_StartElement (URI As String, Name As String, Attributes As Attributes)
Select Case Name
Case "ns3:media-encryption-algorithm"
MediaEncryptionAlgorithm = Attributes.GetValue2("", "text")
End Select