Parsing an XML String returned from webservice

ykucuk

Well-Known Member
Licensed User
Longtime User
Hello,

I need to parse string that return from our web service.

when i invoke this service i get this string ;

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">AABBCCDD</string>

How can i get "AABBCCDD" from this string

thank you
 

ykucuk

Well-Known Member
Licensed User
Longtime User
Hello erel,

i already checked this. it works with return xml type of response but i cant parse when service returns string like i wrote above

could you help me?
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Just use StrTo or something similar. Look for <string and then the next > character and then everything up to the next </ pair of characters..

B4X:
PosOfStart = line.IndexOf("<string")

Then use that to trim the string, ignoring the characters before that position.

Something like this :

B4X:
line = line.SubString(PosOfStart)

Then look for the Pos of the next > character...

B4X:
PosOfEnd = line.IndexOf(">")

and then between the start and the end you've got the string you're interested in.
 
Upvote 0

ykucuk

Well-Known Member
Licensed User
Longtime User
Hi Erel,

is there any sample code for this. i really dont know how to do it.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…