chapter_005/src/main/java/xmlXsltJdbs/Optimization.java
private void safefielnumber2() {
        try {
            String dir = System.getProperty("user.dir") + "\\";

            TransformerFactory factory = TransformerFactory.newInstance();
            Source xslt = new StreamSource(new File(dir + "transform.xslt"));
            Transformer transformer = factory.newTransformer(xslt);

            Source text = new StreamSource(new File(dir + "1.xml"));
            transformer.transform(text, new StreamResult(new File(dir + "2.xml")));

            System.out.println("Save file 2.xml");

        } catch (TransformerException e) {

            e.printStackTrace();

        }

    }
/**
     * Create and safe file number 2.
     */
Create and safe file number 2.
Create and safe file number 2 .
private void safefielnumber2() {
        try {
            String dir = System.getProperty("user.dir") + "\\";
            TransformerFactory factory = TransformerFactory.newInstance();
            Source xslt = new StreamSource(new File(dir + "transform.xslt"));
            Transformer transformer = factory.newTransformer(xslt);
            Source text = new StreamSource(new File(dir + "1.xml"));
            transformer.transform(text, new StreamResult(new File(dir + "2.xml")));
            System.out.println("Save file 2.xml");
        } catch (TransformerException e) {
            e.printStackTrace();
        }
    }
private void safefielnumber2 ( ) { try { String dir = System . getProperty ( "user.dir" ) + "\\" ; TransformerFactory factory = TransformerFactory . newInstance ( ) ; Source xslt = new StreamSource ( new File ( dir + "transform.xslt" ) ) ; Transformer transformer = factory . newTransformer ( xslt ) ; Source text = new StreamSource ( new File ( dir + "1.xml" ) ) ; transformer . transform ( text , new StreamResult ( new File ( dir + "2.xml" ) ) ) ; System . out . println ( "Save file 2.xml" ) ; } catch ( TransformerException e ) { e . printStackTrace ( ) ; } }
Create and safe file number 2.
Create and safe file number 2 .