Code example for TransformerFactory

Methods: newTransformer

0
			dbf = DocumentBuilderFactory.newInstance();
			db = dbf.newDocumentBuilder();
			doc = db.newDocument();
			 
            tff = TransformerFactory.newInstance();
            tf = tff.newTransformer();
             
            tf.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
            tf.setOutputProperty(OutputKeys.INDENT, "yes");
            tf.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
			 
		} catch (Exception e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		}		 
	} 
	 
	public static Document parse(InputStream in){
		synchronized(db){
			try { 
				return db.parse(in);