1、不要用Crimson,过时而且效率低,使用xerces代替;
2、输出DOM Document不能简单使用Java IO,应如下:    /**
     * 将DOM的Document对象写入文件。
     * @param name 文件名称。
     * @param document DOM的Document对象。
     * @return 成功返回0
     * @throws java.io.IOException 写文件时出错。
     */
    public static final synchronized long writeXmlFile( java.lang.String name,
                                                        org.w3c.dom.Document document )
        throws javax.xml.transform.TransformerConfigurationException,
               javax.xml.transform.TransformerException
    {
        DOMSource          doms        = new DOMSource( document );
        File               file        = new File( name );
        StreamResult       result      = new StreamResult( file );
        TransformerFactory tf          = TransformerFactory.newInstance();
        Transformer        transformer = tf.newTransformer();
        Properties         properties  = transformer.getOutputProperties();
        properties.setProperty( OutputKeys.ENCODING, "GB2312" );
        properties.setProperty( OutputKeys.METHOD, "xml" );
        properties.setProperty( OutputKeys.INDENT, "yes" );
        transformer.setOutputProperties( properties );
        transformer.transform( doms, result );
        return 0;
    }