我執行從一個XML格式的XSLT轉換到另一個撒克遜和XSLT,以後有什麼轉變的結果XML轉換成Java的DOM與它進一步的工作:的Java:轉換StreamResult到DOM
System.setProperty("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(new File("xslt.xsl")));
transformer.transform(new StreamSource(new File(inputXML)),
new StreamResult(new File (outputXML)));
DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = documentBuilder.parse(outputXML);
我不喜歡在這種情況下,正在創建中間文件outputXML
。是否有可能避免其創建?
使用['DOMResult'](https://docs.oracle.com/javase/8/docs/api/javax/xml /transform/dom/DOMResult.html)。閱讀文檔。請做一點研究*。 – Andreas
不知道。一直在尋求解決方案。也許我太愚蠢編程:( – Vitaliy
安德烈亞斯,這可能應該被轉移到答案 – MeBigFatGuy