### Parse SOAP Tags

Example parsing some value from SOAP generated XML string.
Target is to get the values for the XML Tag string in Tag ListAccountsResult.
XML File
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<ResponseHeader xmlns="https://URL_HERE">
<Text>3 account(s) found.</Text>
</ResponseHeader>
</soap:Header>
<soap:Body>
<ListAccountsResponse xmlns="https://URL_HERE">
<ListAccountsResult>
<string>12345678,abc,dfg</string>
<string>1234,test,testing</string>
<string>abc123,demo,testing</string>
</ListAccountsResult>
</ListAccountsResponse>
</soap:Body>
</soap:Envelope>
Sample B4J Code tested
`Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private XMLParser As SaxParser
End Sub`
`Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
XMLParser.Initialize
ParseSoapResult
MainForm.Close
End Sub`
`Sub ParseSoapResult
Dim soapresult As String = File.ReadString(File.DirApp, "soapresult.xml")
XMLParser.parse(StringToInputStream (soapresult), "Parser")
End Sub`
`Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)
Select Name
Case "string"
Log(Text.ToString)
End Select
End Sub`
`Sub StringToInputStream (s As String) As InputStream
Dim In As InputStream
Dim data() As Byte = s.GetBytes("UTF8")
In.InitializeFromBytesArray(data, 0, data.Length)
Return In
End Sub`
Output in Log
12345678,abc,dfg
1234,test,testing
abc123,demo,testing

Changed: , Category: XML, File: T6C285M2142.htm, ID: 2142