Needs to cache first x lines for autodetection, then manage stream of updates. See xml2 for the libxml2 API