Fix ApiXmlFormatTest and raw mode handling in api
In the test, raw mode needs to be set after the api module
is initiated and before executed for the test to work as
In ResultBuilder, isRawMode needs to be lazy initialized.
It is always false when the api modules are constructed and
ResultBuilder constructed. It is then set later in the
api module execution process.