你的xml编码是UTF-8,程序更新xml文件,会默认为utf-8编码,所以要对文件声明.
例:
<%@ page contentType="text/html; charset=GB2312" %>
<%@page import="java.io.*,javax.xml.parsers.DocumentBuilder,javax.xml.parsers.DocumentBuilderFactory,java.io.File,org.w3c.dom.Document,org.w3c.dom.Element,org.w3c.dom.NodeList,org.w3c.dom.Node,org.w3c.dom.NamedNodeMap,javax.xml.transform.TransformerFactory,javax.xml.transform.dom.DOMSource,javax.xml.transform.Transformer,javax.xml.transform.stream.StreamResult,org.w3c.dom.Text,java.util.Properties,javax.xml.transform.OutputKeys"%>
<%
    
String title = new String(request.getParameter("title").getBytes("ISO8859_1"),"gb2312");
File docFile = new File("E:\\JSPText\\eweb\\web\\src\\index\\right\\xml\\channels.xml");
Document doc = null; 

try
{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(docFile); //读入xml文档
doc.normalize();
}
catch(javax.xml.parsers.ParserConfigurationException pce)
{
         System.out.println("The parser was not configured correctly.");
         System.exit(1);
}
catch (java.io.IOException ie)
{
System.out.println("Cannot read input file.");
System.exit(1);
}
catch (org.xml.sax.SAXException se)
{
System.out.println("Problem parsing the file.");
System.exit(1);
}
catch (java.lang.IllegalArgumentException ae)
{
System.out.println("Please specify an XML source.");
System.exit(1);
} //java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yy-MM-dd hh:mm:ss"); 
//java.util.Date currentTime_1 = new java.util.Date();
//String str_date = formatter.format(currentTime_1);
    
        Element rootElement = doc.getDocumentElement();
        NodeList nl = rootElement.getElementsByTagName("Channel");
Element e = (Element)nl.item(nl.getLength()-1);
NodeList nl1 = e.getElementsByTagName("ChannelID");
    //out.print(nl1.item(0).getFirstChild().getNodeValue());
int itemID = Integer.parseInt(nl1.item(0).getFirstChild().getNodeValue())+1;        Text textsegcontent = doc.createTextNode(title);
Text textsegID = doc.createTextNode(""+itemID+""); Element elChannel = doc.createElement("Channel");
Element elChannelID = doc.createElement("ChannelID");

Element elcontent = doc.createElement("ChannelName");
    
elChannelID.appendChild(textsegID);
elcontent.appendChild(textsegcontent);
elChannel.appendChild(elChannelID);
elChannel.appendChild(elcontent);
rootElement.appendChild(elChannel);

try
{
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new java.io.File("E:\\JSPText\\eweb\\web\\src\\index\\right\\xml\\channels.xml"));
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
Properties properties = t.getOutputProperties();
properties.setProperty(OutputKeys.ENCODING,"GB2312"); 
t.setOutputProperties(properties); 

t.transform(source, result);

}
catch(Exception t)
{
}

%>
<script language="javascript">
window.opener.location.reload();
window.close();
</script>
要调用Properties与OutputKeys类.