Generating xml file with "&" using java -
i need write <name> dolce & gabanna </name> in xml file using java. however, gets generated <name> dolce & gabanna </name> . is there method can use in java "&" displayed in xml, instead of "&" ? thanks. i need write <name> dolce & gabanna </name> in xml file using java. no, don't. not unless you're trying create invalid file. whatever code you're using doing right thing - xml parser reading file unescape & & appropriate. from xml 1.0 specification, section 2.4 : the ampersand character ( & ) , left angle bracket ( < ) must not appear in literal form, except when used markup delimiters, or within comment, processing instruction, or cdata section. if needed elsewhere, must escaped using either numeric character references or strings " & " , " < " respectively.