Android Question Regex.Match

StarinschiAndrei

Active Member
Licensed User
Longtime User
Hello everybody,
Could anybody help me how can i get the the code value betwen " " ?
I receive different xml structure depends on the API status like :
xml:
<Res Code="0">
<Res Name="FM_Read_only" Value="0" Type="Status" Byte="0" Bit="0" />
......
or
<Res Code="40">
  <Err Source="Server" Type="FPException" STE1="00" STE2="00" FPLibErrorCode="109">
 .........
Thank you
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Sub AppStart (Args() As String)
    Dim s As String = $"<Res Code="0">
<Res Name="FM_Read_only" Value="0" Type="Status" Byte="0" Bit="0" />
</Res>"$
    Dim parser As Xml2Map
    parser.Initialize
    Dim root As Map = parser.Parse(s)
    Log(root)
    Dim attributes As Map = root.Get("Res").As(Map).Get("Attributes")
    Log(attributes.Get("Code"))
End Sub
 
Upvote 0

StarinschiAndrei

Active Member
Licensed User
Longtime User
Thank you ! ! !
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…