Android Question stop parsing xmlparser


Licensed User
After receiving the xml (httputils2 + OkHttp lib), i parse the xml and it works fine.

in the Parser_EndElement i check/read the <Code> and <Opmerking> tag and all other tags i dont need at this stage. How can i stop the parsing of the xml after i have the 2 tags i need?

Below is a simple example of the xml i receive. The <Taken> hold normal much more data and takes a while to process each tag and

-- XML Exampe ---
<Opmerking>Mesage recieved corectly</Opmerking>
-- XML Exampe ---

Each XML i receive has a <Status> with CODE and Opmerking but below </Status> can be different.
Code is use for parsing i tried return to stop parsing but that dont work.

Public Sub GetStatus As Map
    parser.Parse(GetInputStream, "Parser")     
    Return mStatus
End Sub

Sub  Parser_StartElement (Uri As String, Name As String, Attributes As Attributes)
    If Name.ToUpperCase = "STATUS" Then
        If mStatus.IsInitialized = False Then
        End If
    End If
End Sub

Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
    Select Name.ToUpperCase
    Case "CODE"
    Case "OPMERKING"
    Case "STATUS"
    End Select
End Sub