Y ykucuk Well-Known Member Licensed User Longtime User Aug 2, 2013 #1 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
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
Erel B4X founder Staff member Licensed User Longtime User Aug 2, 2013 #2 See this tutorial: http://www.b4x.com/android/forum/threads/6866 Upvote 0
Y ykucuk Well-Known Member Licensed User Longtime User Aug 2, 2013 #3 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
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?
eps Expert Licensed User Longtime User Aug 2, 2013 #4 Just use StrTo or something similar. Look for <string and then the next > character and then everything up to the next </ pair of characters.. Code: Copy PosOfStart = line.IndexOf("<string") Then use that to trim the string, ignoring the characters before that position. Something like this : Code: Copy line = line.SubString(PosOfStart) Then look for the Pos of the next > character... Code: Copy PosOfEnd = line.IndexOf(">") and then between the start and the end you've got the string you're interested in. Upvote 0
Just use StrTo or something similar. Look for <string and then the next > character and then everything up to the next </ pair of characters.. Code: Copy PosOfStart = line.IndexOf("<string") Then use that to trim the string, ignoring the characters before that position. Something like this : Code: Copy line = line.SubString(PosOfStart) Then look for the Pos of the next > character... Code: Copy PosOfEnd = line.IndexOf(">") and then between the start and the end you've got the string you're interested in.
Y ykucuk Well-Known Member Licensed User Longtime User Aug 2, 2013 #5 thanks for reply. i think there should be much easy way. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Aug 2, 2013 #6 If this is the complete XML then you just need to implement the EndElement sub and take the Text value. Upvote 0
If this is the complete XML then you just need to implement the EndElement sub and take the Text value.
Y ykucuk Well-Known Member Licensed User Longtime User Aug 2, 2013 #7 Hi Erel, is there any sample code for this. i really dont know how to do it. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Aug 3, 2013 #8 There is an example in the XML parsing tutorial I previously posted. Upvote 0