ESP32 Arduino: Parsing XML

Опубликовано: 20 Октябрь 2024
на канале: Techtutorialsx
6,828
40

This video explains how to parse a simple XML document using the ESP32 and the Arduino core. In this video we will use the TinyXML-2 library.

Note: On the video, I've mistakenly mentioned that the output of the FirstChildElement method is a XMLDocument object pointer, but it is a XMLElement object pointer.

Tested on an ESP32 FireBeetle board from DFRobot: https://www.dfrobot.com/product-1590....

TinyXML2 GitHub page: https://github.com/leethomason/tinyxml2
TinyXML-2 Documentation page: http://leethomason.github.io/tinyxml2...

Parse method documentation: http://leethomason.github.io/tinyxml2...
FirstChild method documentation: http://leethomason.github.io/tinyxml2...
FirstChildElement method documentation: http://leethomason.github.io/tinyxml2...
QueryIntText method documentation: http://leethomason.github.io/tinyxml2...

In case of error, the QueryIntText method returns:
XML_CAN_NOT_CONVERT_TEXT: if the text cannot be converted to the requested type (int)
XML_NO_TEXT_NODE if there is no child text to query.