code: public void startDocument() throws ODataRenderException {
  
          outputStream = new ByteArrayOutputStream();
          try {
              xmlWriter = xmlOutputFactory.createXMLStreamWriter(outputStream, UTF_8.name());
              xmlWriter.writeStartDocument(UTF_8.name(), XML_VERSION);
              xmlWriter.setPrefix(METADATA, ODATA_METADATA_NS);
          } catch (XMLStreamException e) {
              LOG.error("Not possible to start stream XML");
              throw new ODataRenderException("Not possible to start stream XML: ", e);
          }
      }
docs: Start the XML stream document by defining things like the type of encoding, and prefixes used.
  It needs to be used before calling any write method.
  
  @throws ODataRenderException if unable to render