XML : How to add encoding to xml in java

This might be an repeat question, but now I have search all over the place and still not able to produce the output.

Currently I am getting the xml output, however I am not able to produce the encoding information.

I want this -> <?xml version="1.0" encoding="UTF-8"?> to be added in the 1st line of the xml output.

  @RequestMapping(value = "/ergoproject",method = RequestMethod.GET, produces = MediaType.APPLICATION_XML_VALUE)    

The above snippet is used for the xml output which is like this...

  <List xmlns="">      <item>      <projectname>Test1</projectname>      </item>      <item>      <projectname>Test2</projectname>      </item>      <item>      <projectname>TEST3</projectname>      </item>      <item>      <projectname>Test4</projectname>      </item>      <item>      <projectname>Test5</projectname>      </item>  </List>    

No comments:

Post a Comment