public void transToDocument() throws UnsupportedEncodingException, FileNotFoundException{
		WXParser wxParser = new WXParserHtmlCleaner(inFilename,charset);
		wxParser.init();
		WxMsgItem item = null;
		BufferedWriter writer;
		
		writer = new BufferedWriter(new OutputStreamWriter
				(new FileOutputStream(outFilename),charset));
	
		try {
			while( ( item = wxParser.getNextWxMsgItem())!= null ){
				writer.append(item.toDocument());
			}
		} catch (IOException e) {
			logger.error(e.getMessage()+", close BufferedWriter",e);
			try {
				writer.close();
			} catch (IOException e1) {
				logger.error(e.getMessage(),e);
			}
		}

		
	}