public void startDocument() throws ODataRenderException {
  outputStream=new ByteArrayOutputStream();
  try {
    xmlWriter=XML_OUTPUT_FACTORY.createXMLStreamWriter(outputStream,UTF_8.name());
    metadataWriter=new AtomMetadataWriter(xmlWriter,oDataUri,entityDataModel,nsConfigurationProvider);
    dataWriter=new AtomDataWriter(xmlWriter,entityDataModel,nsConfigurationProvider);
    xmlWriter.writeStartDocument(UTF_8.name(),XML_VERSION);
    xmlWriter.setPrefix(METADATA,nsConfigurationProvider.getOdataMetadataNs());
    xmlWriter.setPrefix(ODATA_DATA,nsConfigurationProvider.getOdataDataNs());
  }
 catch (  XMLStreamException e) {
    LOG.error("Not possible to start stream XML");
    throw new ODataRenderException("Not possible to start stream XML: ",e);
  }
}

public void startDocument ( ) throws ODataRenderException { outputStream = new ByteArrayOutputStream ( ) ; try { xmlWriter = XML_OUTPUT_FACTORY . createXMLStreamWriter ( outputStream , UTF_8 . name ( ) ) ; metadataWriter = new AtomMetadataWriter ( xmlWriter , oDataUri , entityDataModel , nsConfigurationProvider ) ; dataWriter = new AtomDataWriter ( xmlWriter , entityDataModel , nsConfigurationProvider ) ; xmlWriter . writeStartDocument ( UTF_8 . name ( ) , XML_VERSION ) ; xmlWriter . setPrefix ( METADATA , nsConfigurationProvider . getOdataMetadataNs ( ) ) ; xmlWriter . setPrefix ( ODATA_DATA , nsConfigurationProvider . getOdataDataNs ( ) ) ; } catch ( XMLStreamException e ) { LOG . error ( "Not possible to start stream XML" ) ; throw new ODataRenderException ( "Not possible to start stream XML: " , e ) ; } }
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 .
