我试图解析以下XML文件 网址部分提供的网站,但我收到了错误 包含在最后,不知道错误说的是什么。提前谢谢 你的帮助!
package com.lynda.files;
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.NodeList;
import org.xml.sax.SAXException;
public class Main {
public static void main(String[] args) {
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse("http://adaam.ir/");
NodeList list = doc.getElementsByTagName("html");
System.out.println("there are " + list.getLength() + " htmls") ;
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
错误:
[致命错误]:1:4832:实体" raquo"被引用,但没有声明。 org.xml.sax.SAXParseException; systemId:https://knowtechie.com/how-one- 公司计划上,货币化,你的时间/; lineNumber:1; columnNumber:4832; 实体" raquo"被引用,但没有声明。 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(未知来源)com.lynda.files.ReadXML.main(ReadXML.java:21)