1
我想以wddx格式存儲我的本地化文件。Coldfusion wddx with indentation
問題是,有時我需要手動編輯翻譯,這可能是wddx格式的問題,因爲Coldfusion會將它作爲一行保存在文件中。
有沒有辦法讓我在保存前格式化wddx字符串?
Leonti
我想以wddx格式存儲我的本地化文件。Coldfusion wddx with indentation
問題是,有時我需要手動編輯翻譯,這可能是wddx格式的問題,因爲Coldfusion會將它作爲一行保存在文件中。
有沒有辦法讓我在保存前格式化wddx字符串?
Leonti
我不認爲ColdFusion的原生支持縮進XML/WDDX。因此,無論您可以使用xmlindent from cflib.org或者如果你是舒適與Java有可用see this thread像
Transformer transformer = TransformerFactory.newInstance().newTransformer();
// indent and omit xml declaration
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
StreamResult result = new StreamResult(new StringWriter());
DOMSource source = new DOMSource(doc);
transformer.transform(source, result);
return result.getWriter().toString();
正是我需要的多種解決方案! – Leonti