$USD
  • EUR€
  • £GBP
  • $USD
TUTORIALS ESP32

ESP32 Arduino: Parsing XML

DFRobot Dec 18 2019 890


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.html



TinyXML2 GitHub page: https://github.com/leethomason/tinyxml2

TinyXML-2 Documentation page: http://leethomason.github.io/tinyxml2/index.html

Parse method documentation: 
http://leethomason.github.io/tinyxml2/classtinyxml2_1_1_x_m_l_document.html#a1819bd34f540a7304c105a6232d25a1f

FirstChild method documentation: 
http://leethomason.github.io/tinyxml2/classtinyxml2_1_1_x_m_l_node.html#ae7dc225e1018cdd685f7563593a1fe08

FirstChildElement method documentation: 
http://leethomason.github.io/tinyxml2/classtinyxml2_1_1_x_m_l_node.html#a1795a35852dc8aae877cc8ded986e59b

QueryIntText method documentation: 
http://leethomason.github.io/tinyxml2/classtinyxml2_1_1_x_m_l_element.html#a926357996bef633cb736e1a558419632


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.


Tutorials Writer: Techtutorialsx

REVIEW