묻고답하기

안녕하세요.

현재 워드프레스를 사용중입니다.

 

XML 파일을 제공받아 재무정보 페이지를 가져오고 싶은데,

https://goo.gl/vsnZho

해당 페이지에서 예제2를 다운로드 해보니 jps 파일입니다.

 

해당파일의 소스가 아래와 같은데, 

혹시 이걸 워드프레스에서 사용할 수 있도록 하려면 어떻게 수정을 하면 될까요?

혹시 아시는분 계실까요.. 사례도 가능합니다 ㅜㅜ

 

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%<a href="//sir.kr/main/member/?mb_id=naver_0px4v5ok" class="mention_user_info" target="_blank">@page</a> import="java.beans.XMLEncoder"%>
<%@ page import="org.w3c.dom.*" %>
<%@ page import="org.xml.sax.*" %>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.net.*"%>
<%@ page import="javax.xml.parsers.*"%>
<%@ page import="javax.servlet.http.HttpServletResponse.*"%>
<%
    String geturl = "http://asp1.krx.co.kr/servlet/krx.asp.XMLJemu?code=099190";
    String gettime="";
    String DaeCha_ym[]= new String [6];
    String SonIk_ym[]= new String [6];
    String CashFlow_ym[]= new String [6];
    
    String DaeCha_data[][]= new String [10][10];
    String SonIk_data[][]= new String [6][10];
    String CashFlow_data[][]= new String [6][7];
    
    int daeCha_data_length = 0;
    int sonIk_data_length = 0;
    int cashFlow_data_length = 0;
    String line="";
    String xml = "";
    try{
        URL url = new URL(geturl);
        URLConnection conn = url.openConnection();
        HttpURLConnection httpConnection = (HttpURLConnection) conn;
        InputStream is = null;
        InputStreamReader isr = null;
        
        is =  new URL(geturl).openStream();
        isr = new InputStreamReader(is, "UTF-8");
        
        
        
        BufferedReader rd = new BufferedReader(isr,400);
        
        StringBuffer strbuf = new StringBuffer();
        
        
        while ((line = rd.readLine()) != null){
            
              strbuf.append(line);
        }
        
        //System.out.println("재무정보");
        //System.out.println(strbuf.toString());
        
        DocumentBuilderFactory docFact = DocumentBuilderFactory.newInstance();
        docFact.setNamespaceAware(true);
        DocumentBuilder docBuild = docFact.newDocumentBuilder();
        Document doc = docBuild.parse(new InputSource(new StringReader(strbuf.toString())));
        doc.getDocumentElement().normalize();
            
        Element root = doc.getDocumentElement();
        
        
        /*조회시각*/
        NodeList financialTotal = doc.getElementsByTagName("financialTotal");
        
        NamedNodeMap stockinfo = financialTotal.item(0).getAttributes();
        gettime = stockinfo.getNamedItem("querytime").getNodeValue();
        
        /*대차대조표*/
        
        NodeList TBL_DaeCha_ym = doc.getElementsByTagName("TBL_DaeCha");
        NamedNodeMap daeCha_ym = TBL_DaeCha_ym.item(0).getAttributes();
        
        DaeCha_ym[0] = daeCha_ym.getNamedItem("year0").getNodeValue();
        DaeCha_ym[1] = daeCha_ym.getNamedItem("month0").getNodeValue();
        DaeCha_ym[2] = daeCha_ym.getNamedItem("year1").getNodeValue();
        DaeCha_ym[3] = daeCha_ym.getNamedItem("month1").getNodeValue();
        DaeCha_ym[4] = daeCha_ym.getNamedItem("year2").getNodeValue();
        DaeCha_ym[5] = daeCha_ym.getNamedItem("month2").getNodeValue();
        
        NodeList TBL_DaeCha_data = doc.getElementsByTagName("TBL_DaeCha_data");
        daeCha_data_length = TBL_DaeCha_data.getLength();
        
        for(int i=0;i<daeCha_data_length;i++){
            
            NamedNodeMap daeCha_data = TBL_DaeCha_data.item(i).getAttributes();
            
            DaeCha_data[i][0] = daeCha_data.getNamedItem("hangMok"+i).getNodeValue();
            DaeCha_data[i][1] = daeCha_data.getNamedItem("year1Money"+i).getNodeValue();
            DaeCha_data[i][2] = daeCha_data.getNamedItem("year1GuSungRate"+i).getNodeValue();
            DaeCha_data[i][3] = daeCha_data.getNamedItem("year1JungGamRate"+i).getNodeValue();
            DaeCha_data[i][4] = daeCha_data.getNamedItem("year2Money"+i).getNodeValue();
            DaeCha_data[i][5] = daeCha_data.getNamedItem("year2GuSungRate"+i).getNodeValue();
            DaeCha_data[i][6] = daeCha_data.getNamedItem("year2JungGamRate"+i).getNodeValue();
            DaeCha_data[i][7] = daeCha_data.getNamedItem("year3Money"+i).getNodeValue();
            DaeCha_data[i][8] = daeCha_data.getNamedItem("year3GuSungRate"+i).getNodeValue();
            DaeCha_data[i][9] = daeCha_data.getNamedItem("year3JungGamRate"+i).getNodeValue();
            
        }
        
        /*손익계산서*/
        
        NodeList TBL_SonIk_ym = doc.getElementsByTagName("TBL_SonIk");
        NamedNodeMap sonIk_ym = TBL_SonIk_ym.item(0).getAttributes();
        
        SonIk_ym[0] = daeCha_ym.getNamedItem("year0").getNodeValue();
        SonIk_ym[1] = daeCha_ym.getNamedItem("month0").getNodeValue();
        SonIk_ym[2] = daeCha_ym.getNamedItem("year1").getNodeValue();
        SonIk_ym[3] = daeCha_ym.getNamedItem("month1").getNodeValue();
        SonIk_ym[4] = daeCha_ym.getNamedItem("year2").getNodeValue();
        SonIk_ym[5] = daeCha_ym.getNamedItem("month2").getNodeValue();
        
        NodeList TBL_SonIk_data = doc.getElementsByTagName("TBL_SonIk_data");
        
        sonIk_data_length = TBL_SonIk_data.getLength();
        
        for(int i=0;i<sonIk_data_length;i++){
            
            NamedNodeMap sonIk_data = TBL_SonIk_data.item(i).getAttributes();
            
            SonIk_data[i][0] = sonIk_data.getNamedItem("hangMok"+i).getNodeValue();
            SonIk_data[i][1] = sonIk_data.getNamedItem("year1Money"+i).getNodeValue();
            SonIk_data[i][2] = sonIk_data.getNamedItem("year1GuSungRate"+i).getNodeValue();
            SonIk_data[i][3] = sonIk_data.getNamedItem("year1JungGamRate"+i).getNodeValue();
            SonIk_data[i][4] = sonIk_data.getNamedItem("year2Money"+i).getNodeValue();
            SonIk_data[i][5] = sonIk_data.getNamedItem("year2GuSungRate"+i).getNodeValue();
            SonIk_data[i][6] = sonIk_data.getNamedItem("year2JungGamRate"+i).getNodeValue();
            SonIk_data[i][7] = sonIk_data.getNamedItem("year3Money"+i).getNodeValue();
            SonIk_data[i][8] = sonIk_data.getNamedItem("year3GuSungRate"+i).getNodeValue();
            SonIk_data[i][9] = sonIk_data.getNamedItem("year3JungGamRate"+i).getNodeValue();
            
        }
        
        /*현금흐름표*/
        
        NodeList TBL_CashFlow = doc.getElementsByTagName("TBL_CashFlow");
        NamedNodeMap cashFlow_ym = TBL_CashFlow.item(0).getAttributes();
        
        CashFlow_ym[0] = cashFlow_ym.getNamedItem("year0").getNodeValue();
        CashFlow_ym[1] = cashFlow_ym.getNamedItem("month0").getNodeValue();
        CashFlow_ym[2] = cashFlow_ym.getNamedItem("year1").getNodeValue();
        CashFlow_ym[3] = cashFlow_ym.getNamedItem("month1").getNodeValue();
        CashFlow_ym[4] = cashFlow_ym.getNamedItem("year2").getNodeValue();
        CashFlow_ym[5] = cashFlow_ym.getNamedItem("month2").getNodeValue();
        
        NodeList TBL_CashFlow_data = doc.getElementsByTagName("TBL_CashFlow_data");
        
        cashFlow_data_length = TBL_CashFlow_data.getLength();
        
        for(int i=0;i<cashFlow_data_length;i++){
            
            NamedNodeMap cashFlow_data = TBL_CashFlow_data.item(i).getAttributes();
            
            CashFlow_data[i][0] = cashFlow_data.getNamedItem("hangMok"+i).getNodeValue();
            CashFlow_data[i][1] = cashFlow_data.getNamedItem("year1Money"+i).getNodeValue();
            CashFlow_data[i][2] = cashFlow_data.getNamedItem("year1JungGamRate"+i).getNodeValue();
            CashFlow_data[i][3] = cashFlow_data.getNamedItem("year2Money"+i).getNodeValue();
            CashFlow_data[i][4] = cashFlow_data.getNamedItem("year2JungGamRate"+i).getNodeValue();
            CashFlow_data[i][5] = cashFlow_data.getNamedItem("year3Money"+i).getNodeValue();
            CashFlow_data[i][6] = cashFlow_data.getNamedItem("year3JungGamRate"+i).getNodeValue();
            
        }
    
    } catch(Exception e){
        
    }

%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script  src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<link rel="stylesheet" type="text/css" href="css/financialInfo.css"/>
<title>재무정보</title>
</head>
<body>
    <div class="header-wrap">
    재무정보<span><span class="time_img"></span><%=gettime%> 기준</span>
    </div>
    <div class="body-wrap">
        <div class="data-lists">
            <dl>
                <dt><span></span>대차대조표</dt>
                <dd>
                    <table id="balance">
                        <tr>
                            <th rowspan="2">재무항목</th>
                            <%if(!DaeCha_ym[0].equals("")) {%>
                            <th colspan="3"><%=DaeCha_ym[0]%>년 <%=DaeCha_ym[1]%>월</th>
                            <th colspan="3"><%=DaeCha_ym[2]%>년 <%=DaeCha_ym[3]%>월</th>
                            <th colspan="3"><%=DaeCha_ym[4]%>년 <%=DaeCha_ym[5]%>월</th>
                            <%}%>
                        </tr>
                        <tr>
                            <th>금액</th>
                            <th>구성비</th>
                            <th>증감율</th>
                            <th>금액</th>
                            <th>구성비</th>
                            <th>증감율</th>
                            <th>금액</th>
                            <th>구성비</th>
                            <th>증감율</th>
                        </tr>
                        <%if(daeCha_data_length > 0){%>
                            <%for(int i=0;i<daeCha_data_length;i++){ %>
                            <tr>
                                <td><%=DaeCha_data[i][0]%></td>
                                <td><%=DaeCha_data[i][1]%></td>
                                <td><%=DaeCha_data[i][2]%></td>
                                <td><%=DaeCha_data[i][3]%></td>
                                <td><%=DaeCha_data[i][4]%></td>
                                <td><%=DaeCha_data[i][5]%></td>
                                <td><%=DaeCha_data[i][6]%></td>
                                <td><%=DaeCha_data[i][7]%></td>
                                <td><%=DaeCha_data[i][8]%></td>
                                <td><%=DaeCha_data[i][9]%></td>
                            </tr>
                            <%}%>
                        <%}%>
                    </table>
                </dd>
                <dt><span></span>손익계산서</dt>
                <dd>
                    <table id="income_statement">
                        <tr>
                            <th rowspan="2">재무항목</th>
                            <%if(!SonIk_ym[0].equals("")) {%>
                            <th colspan="3"><%=SonIk_ym[0]%>년 <%=SonIk_ym[1]%>월</th>
                            <th colspan="3"><%=SonIk_ym[2]%>년 <%=SonIk_ym[3]%>월</th>
                            <th colspan="3"><%=SonIk_ym[4]%>년 <%=SonIk_ym[5]%>월</th>
                            <%}%>
                        </tr>
                        <tr>
                            <th>금액</th>
                            <th>구성비</th>
                            <th>증감율</th>
                            <th>금액</th>
                            <th>구성비</th>
                            <th>증감율</th>
                            <th>금액</th>
                            <th>구성비</th>
                            <th>증감율</th>
                        </tr>
                        <%if(sonIk_data_length > 0){%>
                            <%for(int i=0;i<sonIk_data_length;i++){ %>
                            <tr>
                                <td><%=SonIk_data[i][0]%></td>
                                <td><%=SonIk_data[i][1]%></td>
                                <td><%=SonIk_data[i][2]%></td>
                                <td><%=SonIk_data[i][3]%></td>
                                <td><%=SonIk_data[i][4]%></td>
                                <td><%=SonIk_data[i][5]%></td>
                                <td><%=SonIk_data[i][6]%></td>
                                <td><%=SonIk_data[i][7]%></td>
                                <td><%=SonIk_data[i][8]%></td>
                                <td><%=SonIk_data[i][9]%></td>
                            </tr>
                            <%}%>
                        <%}%>
                    </table>
                </dd>
                <dt><span></span>현금흐름표</dt>
                <dd>
                    <table id="cash_flow">
                        <tr>
                            <th rowspan="2">재무항목</th>
                            <%if(!CashFlow_ym[0].equals("")) {%>
                            <th colspan="2"><%=CashFlow_ym[0]%>년 <%=CashFlow_ym[1]%>월</th>
                            <th colspan="2"><%=CashFlow_ym[2]%>년 <%=CashFlow_ym[3]%>월</th>
                            <th colspan="2"><%=CashFlow_ym[4]%>년 <%=CashFlow_ym[5]%>월</th>
                            <%}%>
                        </tr>
                        <tr>
                            <th>금액</th>
                            <th>증감액</th>
                            <th>금액</th>
                            <th>증감액</th>
                            <th>금액</th>
                            <th>증감액</th>
                        </tr>
                        <%if(cashFlow_data_length > 0){%>
                            <%for(int i=0;i<cashFlow_data_length;i++){ %>
                            <tr>
                                <td><%=CashFlow_data[i][0]%></td>
                                <td><%=CashFlow_data[i][1]%></td>
                                <td><%=CashFlow_data[i][2]%></td>
                                <td><%=CashFlow_data[i][3]%></td>
                                <td><%=CashFlow_data[i][4]%></td>
                                <td><%=CashFlow_data[i][5]%></td>
                                <td><%=CashFlow_data[i][6]%></td>
                            </tr>
                            <%}%>
                        <%}%>
                    </table>
                </dd>
            </dl>
        </div>
    </div>
    <div class="footer-wrap"></div>
</body>
</html>

 

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
FFLV 추천수 0이면 안뜨게 하고 싶은데 어떻게 해야 하나요? [2] file 2018.12.21 by FFLV
기광공 모바일 뷰에서 정상 화면이 나오게 하고 싶어요. [1] file 2018.12.21 by DoorWeb
검은내일 xe 템플릿 변수를 php로 옮기는 방법이 궁금합니다. [1] 2018.12.21 by 검은내일
피닉스 상단로고 이미지 크기조정.... [3] 2018.12.21 by 피닉스
아름드리나무 기본레이아웃 쓰는데요~ [2] file 2018.12.21 by 아름드리나무
가상 cashbook을쓰고 싶은데요 에러 [1] 2018.12.21 by sejin7940
구덱스 XE 글쓰기가 갑자기 안되네요. [2] file 2018.12.22 by 차니맘
키미즈 게시물이 어떤건 보이고 어떤건 안보입니다 [2] 2018.12.22 by 차니맘
상해파 xe에서 json 호출관련 문의 드립니다.  
베이스 업데이트 후 페이지수정 들어가면 저장버튼이 사라졌습니다. file  
tohappy 로그인 후 js호출문제  
enjoyfun 검색창 사이즈를 살짝 줄이고 싶어요 ㅠㅠ [1] file 2018.12.24 by DoorWeb
안느 jsp소스 -> php소스 변환 가능하실까요?  
soonpu**** xedition 오른쪽 메뉴 [2] file 2018.12.24 by soonpu****
dal 보안테스트에서 XSS 취약점 해결하라는데요...  
dkexpress 로그인 문제입니다. [1] 2018.12.26 by sejin7940
이택진 [포토샵-도트아트] 크기조절... [6] 2018.12.26 by 이전생
질투 글제목 옆에 사진 아이콘이 보이게 하는 방법이.. [2] file 2018.12.26 by 질투
웨마 마우스 롤오버시 목록이미지에 생기는... file  
쟈니 댓글 50개 이상 작성시 접기 file  
넓은바다 xe 모바일접속 통계볼려면 모바일 레이아웃에도 애널리틱스 코드 넣어야되나요? [1] file 2018.12.26 by 즈베즈다
상해파 json 관련 문의?  
레전드 홈페이지화면에 에러 문구가 뜹니다 도와주세요~ [2] file 2018.12.27 by 레전드
짱구삼촌 minishopXE 인증코드받는 방법 [4] 2018.12.27 by 짱구삼촌
레전드 방문자의 접근을 혀용하고 싶습니다. [2] file 2018.12.27 by 레전드
황마마 스케치북5 모바일 보드스킨 검색창이 안나오네요 [2] 2018.12.27 by 티지레몬
상해파 xe 버젼 확인 방법은? [2] 2018.12.27 by 상해파
정민이 특정화면에서 controller 응답값을 못받아 오는 이유  
787dreamliner 사이트 이전시 첨부파일 손상 [1] 2018.12.28 by 787dreamliner
SJ_KK3 모바일에서 팝업2개가 안띄워집니다..