XML Parsing – SAX vs DOM

It is several types of XML parsers on the marked, but as an embedded developer I often struggle with little RAM so I was forced to implement a SAX style parser.

Most parsers you find is DOM parsers that will load the entire XML document into memory and allow you to read/write as if it was a database. This is excellent if you have the space (RAM) for it.

A SAX parser will parse the syntax as bytes arrive and make callbacks to the host to parse content on the fly. I have been running SAX parsers on Arduino with as little as 500 bytes RAM.

Returning to the SAX parser in BSA I assume the parser itself is very fast, but that parsing of content is to slow. I need to find out because it is possible that I have implemented some time-consuming functions as I rebuild the saved model. I know for a fact that a SAX parser is very fast and faster than a DOM parser so I am a bit puzled – but I will find out.

Categories: BSA

Leave a Reply