很简单,但是就是不会弄,读入一个slide.xml的文件,其中只要是<a:t>   </a:t>都需要放到新的文本文件中。。多谢了

解决方案 »

  1.   

    参考下这个http://topic.csdn.net/t/20050418/18/3946904.html
      

  2.   

    这个做的 凑合用吧!!import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;public class html {

    /**
     * @param args
     */
    public static void main(String[] args) {

    String sssss = html.getiwant();
    html.search(sssss);
    }

    private static void search(String ss) {
    String regex = "<a:t>(.+?)</a:t>";
    Pattern pattern = Pattern.compile(regex);
    Matcher matcher = pattern.matcher(ss);
    while (matcher.find()) {
    System.out.println(matcher.group(1).trim());
    try {
    FileOutputStream f = new FileOutputStream("E:/kk.txt", true);
    f.write((matcher.group(1)).getBytes());
    f.close();

    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }

    public static String getiwant(){
    String iwant = "";
    try {
    BufferedReader buf = new BufferedReader(new FileReader(
    "E:\\temp\\aa.txt"));
    String line = "";
    try {
    while ((line = buf.readLine()) != null) {
    iwant =iwant+line;
    }
    } catch (IOException e) {
    e.printStackTrace();
    }
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    }
    System.out.println(iwant);
    return iwant;
    }}你要读入的 文件名 换换
    想把文件 输入 到哪里,叫什么名字都可以换