Contents

조회 수 13219 댓글 0
Atachment
첨부 '1'
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

지인 부탁으로 만들었던 초간단 샘플~

버리기 아까워서 소스코드랑 샘플 xml 올려놓음..

한국일보 RSS 긁어오는 JSP 소스코드 샘플..

<%@ page language="java"
    contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="java.net.URL" %>
<%@ page import="java.util.List" %>
<%@ page import="org.xml.sax.InputSource" %>
<%@ page import="org.jdom.Document" %>
<%@ page import="org.jdom.Element" %>
<%@ page import="org.jdom.input.SAXBuilder" %>

<%
	List list = null;

	try{
		SAXBuilder parser = new SAXBuilder();
		parser.setValidation(false);
		parser.setIgnoringElementContentWhitespace(true);
		//URL url = new URL("http://jsp.hooni.net/rss/sample.xml");
		URL url = new URL("http://rss.hankooki.com/news/hk00_list.xml");
		InputSource is = new InputSource(url.openStream());
		Document doc = parser.build(is);

		Element root = doc.getRootElement();
		Element channel = root.getChild("channel");
		list = channel.getChildren("item");
	}catch(Exception e){
		e.getStackTrace();
	}
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>RSS 열라 파씽</title>
</head>

<body>

<ul>

<%
	if(list!=null){
		for(int i=0; i<list.size(); i++){
			Element el = (Element) list.get(i);
%>
	<li><a href='<%=el.getChildText("link")%>' target=_news>
        <%=el.getChildText("title")%></a></li>
<%
		}
	}else{
%>
	<li>잠시 후 다시 접속하여 주십시오.</li>
<%
	}
%>
</ul>

</body>

</html>


?

  1. [ios] iOS 4.0 beta 에서 3.1.3으로 다운그레이드 하는 법

    Date2013.04.23 CategoryDevelop Byhooni Views37505
    Read More
  2. [ios] iOS 6.0 이상 회전 하기 (이전 버전과 비교 변경 부분)

    Date2014.01.27 CategoryDevelop Byhooni Views34192
    Read More
  3. [ios] iOS 7 이상 UIBarButtonItem 여백

    Date2014.03.27 CategoryDevelop Byhooni Views4058
    Read More
  4. [ios] iOS 8 개발자가 우선 알아야 할 3가지

    Date2014.10.02 CategoryDevelop Byhooni Views920
    Read More
  5. [ios] iOS In App Purchase #1 (코드 구현 전 웹 설정 작업)

    Date2013.11.20 CategoryDevelop Byhooni Views14523
    Read More
  6. [ios] iOS In App Purchase #2 (코드 구현)

    Date2013.11.20 CategoryDevelop Byhooni Views13780
    Read More
  7. [ios] iOS In App Purchase 코드 부분 샘플 1

    Date2013.11.20 CategoryDevelop Byhooni Views11771
    Read More
  8. [ios] iOS In App Purchase 코드 부분 샘플 2

    Date2013.11.20 CategoryDevelop Byhooni Views11289
    Read More
  9. [ios] iOS 사운드 관련 프레임워크

    Date2014.04.18 CategoryDevelop Byhooni Views3023
    Read More
  10. [ios] iOS 앱 아이콘을 만드는 유틸

    Date2015.01.03 CategoryDevelop Byhooni Views882
    Read More
  11. [ios] iOS 의 인앱구매 소개

    Date2014.04.29 CategoryDevelop Byhooni Views3840
    Read More
  12. [ios] iOS앱의 Xcode 빌드 과정

    Date2015.01.03 CategoryDevelop Byhooni Views2291
    Read More
Board Pagination Prev 1 ... 37 38 39 40 41 42 43 44 45 46 ... 98 Next
/ 98