This demo contains a port of the FastXML library. FastXML was hosted on geocities and is offline now. The library itself is contained into two files header and cpp and very easy to use. I don't know how many RAM it eats up but XML is probably not the best thing to use on an microcontroler. Decide your self but be warned. I told you so!!
main.cpp
- Committer:
- rolf
- Date:
- 2009-12-11
- Revision:
- 0:37e8c5cd04e8
File content as of revision 0:37e8c5cd04e8:
#include "mbed.h" #include "fastxml.h" DigitalOut myled(LED1); class tmpr : public FastXmlInterface { public: virtual bool processElement(const char *name, int argc, const char **argv, const char *data, int lineno) { printf("::%s\n", name); if(strncmp(name, "tmpr", 4)==0) { printf("tmpr: %s\n", data); } return true; } }; const char *code = { "<root>\r\n" " <chan1>\r\n" " <tmpr>23.7</tmpr>\r\n" " </chan1>\r\n" " <chan2>\r\n" " <tmpr>23.7</tmpr>\r\n" " </chan2>\r\n" "</root>\r\n" }; int main() { FastXml *xml = createFastXml(); FastXmlInterface *tmp = new tmpr(); xml->processXml(code, strlen(code), tmp); while(1) { myled = 1; wait(0.2); myled = 0; wait(0.2); } }