發表文章 | 發起投票 |
java fatal error 問題
用左呢句 code parse xml file
我用 try catch throw 左 SAXParseException
parse 一個正常 xml file 完全冇問題
但 parse 一個唔係 xml 既 file throw 左 SAXParseException 但個 scope 明明冇任何 print out
都會出返一句 [Fatal Error] <file-name>:1:1: Content is not allowed in prolog.
呢句野,點樣可以唔 show 呢個野
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.xml.sax.SAXParseException;
Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file);
我用 try catch throw 左 SAXParseException
parse 一個正常 xml file 完全冇問題
但 parse 一個唔係 xml 既 file throw 左 SAXParseException 但個 scope 明明冇任何 print out
都會出返一句 [Fatal Error] <file-name>:1:1: Content is not allowed in prolog.
呢句野,點樣可以唔 show 呢個野
本貼文共有 0 個回覆
此貼文已鎖,將不接受回覆
發表文章 | 發起投票 |