Refactored Query::xml(), Query::html(), Query::outerXml() to share most of the logic