码迷,mamicode.com
首页 > 编程语言 > 详细

java 读取xml文件开头多了一个问号

时间:2014-09-26 20:26:09      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:读取问号

File file = new File("D:/xml/PD20140924154_cunchu.xml");

  StringBuilder sb = new StringBuilder();

  FileInputStream fis=null;

  BufferedReader bf=null;

  try {

   fis = new FileInputStream(file);

   bf = new BufferedReader(new InputStreamReader(fis,"utf-8"));

   String str="";

   while((str=bf.readLine())!=null){

    sb.append(str);

   }

  } catch (FileNotFoundException e) {

   e.printStackTrace();

  } catch (IOException e) {

   e.printStackTrace();

  }

  

  System.out.println(sb.toString());

  System.out.println("===============================================");

  System.out.println(sb.toString().replaceAll("##", ">").replaceAll("
\\$\\$
", "<"));

 

?<?xml version="1.0" encoding="utf-8" ?><Assets InventoryNumber="PD20140924154" TaskName="" BatchName="">

 

java 读取xml文件开头多了一个问号

标签:读取问号

原文地址:http://yjm199.blog.51cto.com/4408395/1558516

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!