I need to write <name> Dolce & Gabanna </name> in an xml file using java. However, what gets generated is <name> Dolce & Gabanna </name>.
Is there any method I can use in java so "&" will be displayed in xml, instead of "&"?
Thanks.

I need to write
<name> Dolce & Gabanna </name>in an xml file using java.
No, you don't. Not unless you're trying to create an invalid file. Whatever code you're using is doing exactly the right thing - any XML parser reading the file will then unescape the & to & where appropriate.
From the XML 1.0 specification, section 2.4:
The ampersand character (
&) and the left angle bracket (<) must not appear in their literal form, except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section. If they are needed elsewhere, they must be escaped using either numeric character references or the strings "&" and "<" respectively.
See more on this question at Stackoverflow