在JDK中, DocumentBuilder类的其中一个parse方法如下。
我认为如果在文件路径中包含如日文中文,这个函数无法正常工作。
What do you guys think?
public Document parse(File f) throws SAXException, IOException {
if (f == null) {
throw new IllegalArgumentException("File cannot be null");
}
//convert file to appropriate URI, f.toURI().toASCIIString()
//converts the URI to string as per rule specified in
//RFC 2396,
InputSource in = new InputSource(f.toURI().toASCIIString());
return parse(in);
}
各位如果有不同意见可以跟帖。