为了账号安全,请及时绑定邮箱和手机立即绑定

小白求指教

小白求指教

慕勒7258520 2017-09-16 16:29:21
<?xml version="1.0" encoding="UTF-8"?><bookstor><book id="1"><title>""wewe"</title><price>111</price></book><book id="2"><title>"edds"</title><price>234</price></book></bookstor>package re;import java.io.IOException;import javax.xml.parsers.DocumentBuilder;import javax.xml.parsers.DocumentBuilderFactory;import javax.xml.parsers.ParserConfigurationException;import org.w3c.dom.Document;import org.w3c.dom.NamedNodeMap;import org.w3c.dom.NodeList;import org.xml.sax.SAXException;public class Test { public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory a=DocumentBuilderFactory.newInstance(); DocumentBuilder b=a.newDocumentBuilder(); Document c=b.parse("NewFile.xml"); NodeList d=c.getElementsByTagName("book"); System.out.println(d.getLength()); }}[Fatal Error] NewFile.xml:1:39: 文件提前结束。org.xml.sax.SAXParseException; systemId: file:///C:/Users/Administrator/workspace/333/NewFile.xml; lineNumber: 1; columnNumber: 39; 文件提前结束。 at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 1252 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信