??? 11/13/09 21:46 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#170781 - ready-made and home-made Responding to: ???'s previous message |
There may be something suitable around, but if not, it is not that impossible to write one from scratch.
After having researched various XML parsers briefly, I rolled out my own for a PC-based project. It's in Pascal, so not of much use here; but I want to share my experience here rather than code. It deliberately does not implements all the bells and whistles of XML standard, But I could afford that, as it's me who supplies the XML input to it. Also, I knew I would be able to process the data as they are parsed, on the fly, so I don't store the whole input in the memory, just a relatively simple status information. This imposes limitiations on the use, but I believe it's orders of magnitude lower footprint in all aspects than most of other implementations around. Even then, to be able to correctly parse nested structures, dynamically allocated memory is inevitable - so if memory is limited, the input XML data must either be restricted in some way, or nesting beyond some predetermined depth must result in a runtime error (which is always sort of a puzzle to solve in embedded systems). The parser itself is a relatively straighforward state machine, with states like "waiting for '<'", "waiting for next character of the tag or a delimiter (space or '=')", "waiting for attribute name, '/' or '>'" etc. It is perhaps a good idea to write it first on a PC, debug with some example inputs, and port to the microcontroller only after that one works. JW |
Topic | Author | Date |
XML | 01/01/70 00:00 | |
an XML library that I can use with SDCC | 01/01/70 00:00 | |
ready-made and home-made | 01/01/70 00:00 | |
Here's a couple I found![]() | 01/01/70 00:00 |