v12345vtm

arduinoXMLpasere

May 11th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. void setup() {
  2. // put your setup code here, to run once:
  3. Serial.begin(115200);
  4. }
  5.  
  6. void loop() {
  7. // put your main code here, to run repeatedly:
  8.  
  9. int teller = 0;
  10. String xmlParse = "<i4>"; //parse this xml element
  11. int xmlElementlength = 4;
  12. String ruwedata ="";
  13. String fb = "<methodResponse><params><param><value><array><data><value><i4>0</i4></value><value><i4>64</i4></value><value><i4>130</i4></value><value><i4>1</i4></value><value><i4>0</i4></value></data></array></value></param></params></methodResponse>";
  14. Serial.println("");
  15.  
  16. for (int i = 0; i < fb.length(); i++) {
  17. if (fb.substring(i, i + 4) == "<i4>") {
  18. //irstVal = fb.substring(0, i);
  19. teller++;
  20. Serial.print(teller);// <i4> element teller
  21. Serial.print("\t" + String(i) + "\t ruwe element data "); // <i4> element teller
  22. Serial.println("\t"+fb.substring(i + 4, i + 4 + 4)); // start vd inhoud vh element en tis max 3karakters
  23. ruwedata = fb.substring(i + 4, i + 4 + 3);
  24.  
  25.  
  26. // for (int i = 0; i < ruwedata.length(); i++) {
  27. // if (ruwedata.substring(i, i + 1) == "<") {
  28. //
  29. // {
  30. // Serial.println("\t xml="+ruwedata.substring(0, i));// <i4> element teller
  31. // }
  32. // }
  33. //
  34. // }
  35.  
  36.  
  37.  
  38. }
  39. }
  40. Serial.println(teller);
  41.  
  42. delay(99999);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment