2020-11-27 05:33:55 -05:00
|
|
|
//
|
|
|
|
// FILE: XMLWriterPrint_1.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
2021-11-11 14:36:58 -05:00
|
|
|
// VERSION: 0.1.1
|
2020-11-27 05:33:55 -05:00
|
|
|
// PURPOSE: demo Print interface
|
|
|
|
// DATE: 2020-07-07
|
|
|
|
// URL: https://github.com/RobTillaart/XMLWriter
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <XMLWriter.h>
|
|
|
|
|
|
|
|
XMLWriter XML(&Serial);
|
|
|
|
|
|
|
|
char buffer[24];
|
|
|
|
|
2021-11-11 14:36:58 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
|
|
|
XML.newLine(0);
|
|
|
|
XML.print("\n");
|
|
|
|
XML.header();
|
|
|
|
XML.comment("XMLWriter Print interface");
|
|
|
|
XML.setConfig(0); // no indent, no (further) comments
|
|
|
|
|
|
|
|
// The {} are not mandatory shows the XML structure in the code...
|
|
|
|
|
|
|
|
XML.tagOpen("Order");
|
|
|
|
{
|
|
|
|
|
|
|
|
XML.println();
|
|
|
|
XML.tagOpen("Address stamp");
|
|
|
|
{
|
|
|
|
XML.println("Mr. D. Bowie\nSpiderstreet 42\n54321 Mars");
|
|
|
|
}
|
|
|
|
XML.tagClose();
|
|
|
|
|
|
|
|
XML.println();
|
|
|
|
|
|
|
|
XML.tagOpen("Actions");
|
|
|
|
{
|
|
|
|
XML.println("[ ] Two tickets for Central Park");
|
|
|
|
XML.println("[ ] Diner at the Ritz");
|
|
|
|
XML.println("[ ] Surprise Hotel");
|
|
|
|
}
|
|
|
|
XML.tagClose();
|
|
|
|
XML.println();
|
|
|
|
}
|
|
|
|
XML.tagClose();
|
|
|
|
XML.flush();
|
|
|
|
}
|
|
|
|
|
2021-11-11 14:36:58 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-11-11 14:36:58 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
// -- END OF FILE --
|
2021-11-11 14:36:58 -05:00
|
|
|
|