將大量有規律txt文本數據轉換成xml格式,在導入excel,生成excel文件,在導入spass中,對數據進行分析

【文本數據   2.txt】下面是其中兩條
Title-題名:  供應鏈競爭力內涵與模型構建研究
Author-作者:  餘暉;張文傑;
Organ-單位:  北京交通大學經濟管理學院;
Source-文獻來源:  中國流通經濟
Keyword-關鍵詞:  供應鏈競爭力;;關鍵業務流程;;核心能力
Summary-摘要:  本文認爲,供應鏈競爭力是某一供應鏈相對於競爭對手錶現出來的更能適應市場需求和變化的各種生存與發展能力的總和,這種能力是供應鏈成員企業內外部資源優化配置與核心能力充分整合的結果,能使供應鏈最終獲得高水平的客戶滿意度,併爲成員企業帶來超額利潤。供應鏈競爭力並非存在於單個企業內部,它是供應鏈系統的整體競爭優勢,對於供應鏈競爭力,需要基於系統論的觀點加以認識。本文建立的供應鏈競爭力模型深入揭示了構成供應鏈競爭力的關鍵能力。文章指出,供應鏈競爭力的形成受供應鏈核心能力(決定力)、供應鏈運作機制(助力)、供應鏈競爭力評價(維持力)等三方面力量的影響,三者依照一定的邏輯關係形成供應鏈競爭力。其中,供應鏈核心能力是供應鏈競爭力的直接來源,是供應鏈競爭力的決定性因素。而供應鏈組織能力、運營能力與整合能力是供應鏈核心能力的三大組成部分,三大能力決定了供應鏈競爭力的高低,而三大能力的高低取決於與之相關的供應鏈基本業務管理水平。在供應鏈競爭實踐中,需要企業從每一項供應鏈基本業務活動中挖掘和培育供應鏈競爭優勢。
PubTime-發表時間:  2009-03-23
Title-題名:  供應鏈運作風險影響供應鏈績效的實證研究
Author-作者:  陳敬賢;施國洪;馬漢武;
Organ-單位:  江蘇大學工商管理學院;東南大學系統工程研究所;
Source-文獻來源:  工業工程與管理
Keyword-關鍵詞:  供應鏈;;運作風險;;績效;;結構方程模型;;實證研究
Summary-摘要:  從實證研究的角度研究了供應鏈運作風險對供應鏈績效的影響。將供應鏈運作風險歸納爲供應風險、需求風險、製造過程風險和信息風險四類,選擇供應鏈可靠性、柔性、服務質量和財務績效四個變量描述供應鏈績效,構建了一個反映二者關係的概念模型。通過對國內製造業企業的問卷調研,利用結構方程模型軟件LISREL8.70對模型進行了統計檢驗,得到了研究結果。研究結果表明:製造過程風險和信息風險對供應鏈績效有顯著的直接影響;供應風險和需求風險對供應鏈績效無顯著的直接影響,但通過與製造過程風險和信息風險的相關關係間接影響供應鏈績效。研究結論爲製造企業實際的供應鏈風險管理提供理論借鑑。
PubTime-發表時間:  2009-08-10

【生成xml文件 fei2.xml】

<?xml version="1.0" encoding="UTF-8"?>

<articles>
  <article>
    <article_id>1</article_id>
    <article_title>供應鏈競爭力內涵與模型構建研究</article_title>
    <article_author>餘暉;張文傑;</article_author>
    <article_organ>北京交通大學經濟管理學院;</article_organ>
    <article_source>中國流通經濟</article_source>
    <article_keyword>供應鏈競爭力;;關鍵業務流程;;核心能力</article_keyword>
    <article_summary>本文認爲,供應鏈競爭力是某一供應鏈相對於競爭對手錶現出來的更能適應市場需求和變化的各種生存與發展能力的總和,這種能力是供應鏈成員企業內外部資源優化配置與核心能力充分整合的結果,能使供應鏈最終獲得高水平的客戶滿意度,併爲成員企業帶來超額利潤。供應鏈競爭力並非存在於單個企業內部,它是供應鏈系統的整體競爭優勢,對於供應鏈競爭力,需要基於系統論的觀點加以認識。本文建立的供應鏈競爭力模型深入揭示了構成供應鏈競爭力的關鍵能力。文章指出,供應鏈競爭力的形成受供應鏈核心能力(決定力)、供應鏈運作機制(助力)、供應鏈競爭力評價(維持力)等三方面力量的影響,三者依照一定的邏輯關係形成供應鏈競爭力。其中,供應鏈核心能力是供應鏈競爭力的直接來源,是供應鏈競爭力的決定性因素。而供應鏈組織能力、運營能力與整合能力是供應鏈核心能力的三大組成部分,三大能力決定了供應鏈競爭力的高低,而三大能力的高低取決於與之相關的供應鏈基本業務管理水平。在供應鏈競爭實踐中,需要企業從每一項供應鏈基本業務活動中挖掘和培育供應鏈競爭優勢。</article_summary>
    <article_puttime>2009-03-23</article_puttime>
  </article>
  <article>
    <article_id>2</article_id>
    <article_title>供應鏈運作風險影響供應鏈績效的實證研究</article_title>
    <article_author>陳敬賢;施國洪;馬漢武;</article_author>
    <article_organ>江蘇大學工商管理學院;東南大學系統工程研究所;</article_organ>
    <article_source>工業工程與管理</article_source>
    <article_keyword>供應鏈;;運作風險;;績效;;結構方程模型;;實證研究</article_keyword>
    <article_summary>從實證研究的角度研究了供應鏈運作風險對供應鏈績效的影響。將供應鏈運作風險歸納爲供應風險、需求風險、製造過程風險和信息風險四類,選擇供應鏈可靠性、柔性、服務質量和財務績效四個變量描述供應鏈績效,構建了一個反映二者關係的概念模型。通過對國內製造業企業的問卷調研,利用結構方程模型軟件LISREL8.70對模型進行了統計檢驗,得到了研究結果。研究結果表明:製造過程風險和信息風險對供應鏈績效有顯著的直接影響;供應風險和需求風險對供應鏈績效無顯著的直接影響,但通過與製造過程風險和信息風險的相關關係間接影響供應鏈績效。研究結論爲製造企業實際的供應鏈風險管理提供理論借鑑。</article_summary>
    <article_puttime>2009-08-10</article_puttime>
  </article>
<articles>

【導入excel】生成excel文件



【導入spss】


現在就可以對數據進行  分析了,   剩下就是怎麼使用spss的問題了,本人,不是很熟,這裏只是對數據進行了一下處理。

用到了dom4j生成xml文件,也試過生成數據庫access文件,因爲access數據庫文件可以導入到excel中生成excel表,

但是亂碼,java代碼插入到access,



【java代碼】

用到的dom4j包

-----ant_u-d.jar

-----dom4j-1.6.jar

-----jaxen-1.1-beta-9.jar


package com.feihuale.myreader;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;

public class ReadTXTtoDB {
	
	static InputStream is;

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		
		List ids = new ArrayList();
		List titles = new ArrayList();
		List authors = new ArrayList();
		List organs = new ArrayList();
		List sources = new ArrayList();
		List keywords = new ArrayList();
		List summarys = new ArrayList();
		List pubtimes = new ArrayList();
		getResult(ids,titles,authors,organs,sources,keywords,summarys,pubtimes);
		buildXml(ids,titles,authors,organs,sources,keywords,summarys,pubtimes);
		
	}
	private static void buildXml(List ids, List titles, List authors, List organs, List sources,List keywords, List summarys, List pubtimes)
	throws IOException {
		//1 創建document對象
		Document doc = DocumentHelper.createDocument();
		//2 在document中添加root元素
		Element root = doc.addElement("articles");
		for(int i=0;i<ids.size();i++){
			Element student = root.addElement("article");
				Element article_id = student.addElement("article_id");
					article_id.setText(ids.get(i)+"");
				Element article_title = student.addElement("article_title");
					article_title.setText(titles.get(i)+"");
				Element article_author = student.addElement("article_author");
					article_author.setText(authors.get(i)+"");
				Element article_organ = student.addElement("article_organ");
				article_organ.setText(organs.get(i)+"");
				Element article_source = student.addElement("article_source");
				article_source.setText(sources.get(i)+"");
				Element article_keyword = student.addElement("article_keyword");
					article_keyword.setText(keywords.get(i)+"");
				Element article_summary = student.addElement("article_summary");
					article_summary.setText(summarys.get(i)+"");
					
				Element article_puttime = student.addElement("article_puttime");
					article_puttime.setText(pubtimes.get(i)+"");
				FileWriter fw = new FileWriter("fei2.xml");
					OutputFormat outputformat = OutputFormat.createPrettyPrint();
					XMLWriter xw = new XMLWriter(fw,outputformat);
					xw.write(doc);
					xw.close();
		}
		System.out.println("文件生成");
	}

	private static void  getResult(List ids, List titles, List authors, List organs, List sources, 
			List keywords,
			List summarys, List pubtimes) {
		// TODO Auto-generated method stub
		File file = new File("2.txt");
		//逐行讀取文件內容
		try {
			is = new FileInputStream(file);
			BufferedReader reader = new BufferedReader(new InputStreamReader(is));
			String line = "";
			int count = 0;
			
			Map<String,Object> mapName = null;
			mapName = new HashMap<String,Object>();
			int tt = 0;
			System.out.println(titles.size());
			while((line = reader.readLine())!= null){
				if("Title".equals(line.substring(0, line.indexOf("e")+1))){
					titles.add( line.substring(line.indexOf(":")+1,line.length()).trim() );
				}
				if("Author".equals(line.substring(0, line.indexOf("r")+1))){
					authors.add(line.substring(line.indexOf(":")+1,line.length()).trim());
				}
				if("Organ".equals(line.substring(0, line.indexOf("n")+1))){
					organs.add(line.substring(line.indexOf(":")+1,line.length()).trim());
				}
				if("Source".equals(line.substring(0, line.indexOf("e")+1))){
					sources.add(line.substring(line.indexOf(":")+1,line.length()).trim());
				}
				if("Keyword".equals(line.substring(0, line.indexOf("d")+1))){
					keywords.add(line.substring(line.indexOf(":")+1,line.length()).trim());
				}
				if("Summary".equals(line.substring(0, line.indexOf("y")+1))){
					summarys.add(line.substring(line.indexOf(":")+1,line.length()).trim());
				}
				if("PubTime".equals(line.substring(0, line.indexOf("e")+1))){
					pubtimes.add(line.substring(line.indexOf(":")+1,line.length()).trim());
				}
				count++;
				
				if(count%7==0){
					ids.add(++tt);
				}
			}
			System.out.println(ids);
			System.out.println(titles);
			System.out.println(authors);
			System.out.println(organs);
			System.out.println(sources);
			System.out.println(keywords);
			System.out.println(summarys);
			System.out.println(pubtimes);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
}





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章