안드로이드 개발 질문/답변
(글 수 45,052)
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Source cannot be resolved to a type
Source cannot be resolved to a type
at parser.main(parser.java:18)
자바로 실행 하려고 하는데 이런 에러가 뜹니다.
jericho 파서는 받아논 상탠데요...
import java.util.*; import java.io.*; import java.net.*;
public class parser {
public static void main(String[] args) throws Exception {
int index, indexEnd, hIndex, hIndexEnd;
String str = "";
String sourceUrlString="싸이트 주소";
if (args.length==0)
System.err.println("Using default argument of \""+sourceUrlString+'"');
else
sourceUrlString=args[0];
if (sourceUrlString.indexOf(':')==-1) sourceUrlString="file:"+sourceUrlString;
Source source=new Source(new URL(sourceUrlString));
String renderedText=source.getRenderer().toString();
System.out.println("\nSimple rendering of the HTML document:\n");
// System.out.println(renderedText);
str = renderedText;
index = str.indexOf("공지");
indexEnd = index+1;
index = str.indexOf("공지", indexEnd);
indexEnd = str.indexOf('\n', index);
System.out.println(str.substring(index, indexEnd));
for(int i=0; i<1; i++){
index = indexEnd+3;
indexEnd = str.indexOf('\n', index);
System.out.println(str.substring(index, indexEnd));
}
index = indexEnd+3;
indexEnd = str.indexOf('\n', index);
System.out.println(str.substring(index, indexEnd));
ArrayList<NoticeList> arNotice = new ArrayList<NoticeList>();
String num, title, hit, date;
index = str.indexOf("공지");
indexEnd = index+1;
index = str.indexOf("공지", indexEnd);
NoticeList nt;
for (int i = 0; i < 50; i++) {
nt = new NoticeList();
if(i == 0){
indexEnd = str.indexOf('\n', index);
nt.num = str.substring(index, indexEnd-1);
}
else{
index = indexEnd+3;
indexEnd = str.indexOf('\n', index);
nt.num = str.substring(index, indexEnd-1);
}
index = indexEnd+3;
indexEnd = str.indexOf('\n', index);
nt.title = str.substring(index, indexEnd-1);
index = indexEnd+3;
indexEnd = str.indexOf('\n', index);
nt.hit = str.substring(index, indexEnd-1);
index = indexEnd+3;
indexEnd = str.indexOf('\n', index);
nt.date = str.substring(index, indexEnd-1);
arNotice.add(nt);
}
for(int i=0; i<arNotice.size(); i++){
nt = arNotice.get(i);
System.out.println(nt.num + " : " + nt.title + ", " + nt.hit + ", " +
nt.date + '\n' + nt.link);
System.out.println();
}
}
}
class NoticeList {
String num, title, hit, date, link;
}
import해서 쓰려면 어떻게 해야 하나요....
빌드패쓰 하는 것부터 조언좀 부탁드립니다.



