묻고답하기

안녕하세요.

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

 

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 남기남
안느 jsp소스 -> php소스 변환 가능하실까요?  
enjoyfun 검색창 사이즈를 살짝 줄이고 싶어요 ㅠㅠ [1] file 2018.12.24 by DoorWeb
tohappy 로그인 후 js호출문제  
베이스 업데이트 후 페이지수정 들어가면 저장버튼이 사라졌습니다. file  
상해파 xe에서 json 호출관련 문의 드립니다.  
키미즈 게시물이 어떤건 보이고 어떤건 안보입니다 [2] 2018.12.22 by 차니맘
구덱스 XE 글쓰기가 갑자기 안되네요. [2] file 2018.12.22 by 차니맘
가상 cashbook을쓰고 싶은데요 에러 [1] 2018.12.21 by sejin7940
아름드리나무 기본레이아웃 쓰는데요~ [2] file 2018.12.21 by 아름드리나무
검은내일 xe 템플릿 변수를 php로 옮기는 방법이 궁금합니다. [1] 2018.12.21 by 검은내일
기광공 모바일 뷰에서 정상 화면이 나오게 하고 싶어요. [1] file 2018.12.21 by DoorWeb
FFLV 추천수 0이면 안뜨게 하고 싶은데 어떻게 해야 하나요? [2] file 2018.12.21 by FFLV
개똥이다 모듈에 국가 코드중 중국어 추가 하면 오류가 납니다.  
쟈니 게시글 등록, 댓글 등록 단축키 [2] 2018.12.20 by 쟈니
쟈니 익명게시판에서 댓글 작성자 클릭시 댓글에 표시하게할수는 없을까요?  
돼지꿈 지금, 관리자페이지 사이트디자인설정안되는거맞죠?  
권만주 이미지 리사이즈할 때 메타정보 살리는 방법 없을까요? [3] 2018.12.19 by 권만주
psjj**** 윈도우10에 설치할려고 합니다.  
callipark 에러 메세지 해결 방법 문의드립니다. ㅠㅠ  
NAMSOON 혹시 이부분 수정가능한가요? [2] file 2018.12.19 by NAMSOON
HSHAM 오늘 갑자기 게시글이 하나도 안보입니다. [1] 2018.12.19 by sejin7940
검은내일 XE를 SSO구현하는데 질문입니다.  
공주 안녕하세요 file  
파워마케팅 안녕하세요 file  
쏘쏘쏘 게시물 뷰어 익명 처리 방법  
homi**** 처음 설치하는데 php 오류가나요 [2] 2018.12.18 by homi****
Williamhoo 게시판 분류 폭 문제. file  
sol**** 홈페이지가 닫혀서 노출이 되질 않습니다. file  
네오스카이 쿼리문 순서 변경 [2] 2018.12.17 by 네오스카이
김성준 에러문의 "통합 검색을 사용할 수 없습니다." [2] file 2018.12.17 by ITNJOB