< prev index next >

test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java

Print this page




  68         String xmlFile = XML_DIR + "cities.xml";
  69 
  70         try (FileInputStream fis = new FileInputStream(xmlFile);
  71                 FileOutputStream fos = new FileOutputStream(outputFile)) {
  72             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  73             dbf.setNamespaceAware(true);
  74             DOMSource domSource = new DOMSource(dbf.newDocumentBuilder().
  75                     parse(new File(xsltFile)));
  76 
  77             Transformer transformer = TransformerFactory.newInstance().
  78                     newTransformer(domSource);
  79             StreamSource streamSource = new StreamSource(fis);
  80             StreamResult streamResult = new StreamResult(fos);
  81 
  82             transformer.setOutputProperty("indent", "no");
  83             transformer.transform(streamSource, streamResult);
  84         }
  85         assertTrue(compareWithGold(goldFile, outputFile));
  86     }
  87 }
  88 
  89 


  68         String xmlFile = XML_DIR + "cities.xml";
  69 
  70         try (FileInputStream fis = new FileInputStream(xmlFile);
  71                 FileOutputStream fos = new FileOutputStream(outputFile)) {
  72             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  73             dbf.setNamespaceAware(true);
  74             DOMSource domSource = new DOMSource(dbf.newDocumentBuilder().
  75                     parse(new File(xsltFile)));
  76 
  77             Transformer transformer = TransformerFactory.newInstance().
  78                     newTransformer(domSource);
  79             StreamSource streamSource = new StreamSource(fis);
  80             StreamResult streamResult = new StreamResult(fos);
  81 
  82             transformer.setOutputProperty("indent", "no");
  83             transformer.transform(streamSource, streamResult);
  84         }
  85         assertTrue(compareWithGold(goldFile, outputFile));
  86     }
  87 }


< prev index next >