我有以下代码将字符串写入xml文件:
private void writeToCucumberXml(Document doc, String filePath) throws TransformerException {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File(filePath));
transformer.transform(source, result);
}
doc是通过解析xml文件创建的文档。
在vi(cygwin环境)中打开时,生成的输出(在Windows环境中运行之后)显示许多^ M字符。如何让xml文件编写器跳过编写^ M个字符的操作?