Esp32 returned sensor value as xml , how to parse

Returned from esp32 dev module, ultrasonic,ldr and a few switches.
300.0
<SONIC_THRESHOLD>82</SONIC_THRESHOLD>
30.0
1
0
0
0

I have a ESP32 dev retuning sensor values , above is whats returned. I have it displaying as a web page and works fine . New to mit app inventor and want to build an app just to look at ultrasonic value and compare with ultrasonic threshold value from a slider . B1 is the ultrasonic actual value. Started simple and got this to work for a switch. Lable changes when switch is turned on. But dont know ho to parse the xml to get both actual and sonic slider value.
any help appreciated.
David

below is the Generated XML: (editted to show markup - ABG)

<Data>

<B0>0</B0>

<V0>0.0</V0>

<B1>300.0</B1>

<V1>30.0</V1>

<LED>1</LED>

<SWITCH>0</SWITCH>

<PIR>0</PIR>

<ALARM>0</ALARM>

<BUZZER>0</BUZZER>

<SONIC_THRESHOLD>82</SONIC_THRESHOLD></Data>

Generated XML:

Data missing in the original.

Sorry for all the info, but when i copy and paste from serial, looks ok but missing info when i send.

300 actual reading
<SONIC_THRESHOLD>82</SONIC_THRESHOLD> slider value

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

export_and_upload_aia

.

..

esp32_data.aia (2.9 KB)
looked at a number of tutorials but can not find a good one that uses wifi and sensor values.
got a label to change color on a button state changing. but cant seem to find a good tutorial on parsing xml sensor values from a returned xml file.

I looked at your blocks, hoping to find a responseContent provider I could call on.

You are trying to get a response from 192.168.1.1, a typical home router address local only to you.

You are allowed only one event block of a particular type per component.
(Notice the red X's?)

Prove to us that you are indeed receiving XML.

Show us what arrives in your responseContent (if anything).

I apologize, somehow you received XML but the board hid it in your post.
Add ``` between lines exposed it.

The Web XML parser returned an unusual structure when fed your XML:

I can't explain where all that duplication came from.
(Getting 'Data' wrong ('DATA') didn't help)

This is a less buggy decode block for your XML:

image

This works better:

xml_parse.aia (2.9 KB)



I built a sensors display on an esp32 it acts as a local server. I can connect through a regular html and interact with it it works perfectly. My idea is to take it to the next level. Create an app add count down timer, graphically display data, so I am working on learning a few different things, hopefully I can build individual apps and then integrate all together as the final app, plenty good tutorial on timers , but have struggled to get a good tutorial on sensors, some use jason some lists some , bit confused as how to get the readings, I think once I understand ho to get one value then I can push on and build a good interactive app . Just a bit of background the initial post was a bit rushed and confusing,
My apologies
David

Adjust my sample xml text block to include that <?xml version header and see if my parse code still works.

Or just feed the response content directly to the web XML decode block and lookup in pairs that worked on your sample.

Thanks for the quick response