xsl解析xml文件
怎么在xsl中解析xml文件中的空格和换行??
[解决办法]
用序列化解决DOM输出XML文件自动换行问题
import java.io.*;
import java.util.*;
import javax.xml.parsers.*;
import com.sun.org.apache.xml.internal.serialize.*;
import org.w3c.dom.*;
public void output(String filePath) {
try {
PrintWriter pwriter = new PrintWriter(new FileOutputStream(filePath));
XMLSerializer serl = new XMLSerializer(pwriter, new OutputFormat("xml", "UTF-8", true));
serl.serialize(doc);
pwriter.close();
} catch (FileNotFoundException ex) {
} catch (IOException ex) {
}
}