我试着做Y!为了使用BlueJ学习,天气XML解析。当我编译课程时,BlueJ给了我错误:package org.w3c does not exist
以下是代码:
import java.net.URL;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.*;
public class WeatherApp
{
public static void main(String[] args)
{
URL xmlURL = new URL("http://weather.yahooapis.com/forecastrss?w=22722924&u=c");
InputStream xml = xmlURL.openStream();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(xml);
xml.close();
System.out.println(doc);
}
}
这里可能出现什么问题?以及如何解决它?感谢