Hi
I'm trying to do a esp8266 PC hardware monitor, but I'm using Arduino IDE to write the code. I found a perfect PC program for this job (MSI Afterburner) and it basically starts a server, in which it updates a XML document every second. I want to be able to take some data off it and put it on a oled display. I found a guy (INT 21h;, INT 21h - Electronics | ESP8266 | Programming - ESP8266: Погода из Яндекса и часы по NTP) who made a similar project and he used a library called "tinyXML2". Using his program as a foundation, I started to write my own code.
His Code:
HTTPClient http;
http.begin(Url);
Serial.println(Url);
int httpCode = http.GET();
if (httpCode > 0) {
Serial.println(httpCode);
if (httpCode == HTTP_CODE_OK) {
String payload = http.getString();
XMLDocument doc;
doc.Parse( payload.c_str() );
XMLElement* dayElement = doc.FirstChildElement( "info" )->
FirstChildElement( "weather" )->FirstChildElement( "day" )->FirstChildElement( "day_part" );
const char* temp = dayElement->FirstChildElement( "temperature" )->GetText();
const char* pressure = dayElement->FirstChildElement( "pressure" )->GetText();
const char* dampness = dayElement->FirstChildElement( "dampness" )->GetText();
const char* wind = dayElement->FirstChildElement( "wind_speed" )->GetText();
const char* wind_direction = dayElement->FirstChildElement( "wind_direction" )->Attribute("id");
const char* weather_code = dayElement->FirstChildElement( "weather_code" )->GetText();
}
his XML (structure):
<a>
<b>
<c>text</c>
<d>value</d>
</b>
</a>
And this is my problem. The structure of my XML looks something like this:
<a>
<b>
<c>text</c>
<d>value</d>
</b>
<b>
<c>text2</c>
<d>value2</d>
</b>
</a>
I found something called NextSiblingElement, but I can't figure out how it works.
Can anyone help???
P.S. Sorry for my bad english.