// 사전 준비
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder;
URL url = new URL(OPEN API 전체 URL);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.getResponseCode(); // OPEN API에 대한 요청 코드
String responseXml = response.toString();
builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(responseXml))); // 데이터 파싱
if (document.getElementsByTagName("error").getLength() > 0)
document.getElementsByTagName("description").item(0).getChildNodes().getLength() // 데이터 유무 판단
document.getElementsByTagName("description").item(0).getChildNodes().item(0).getNodeValue(); // 데이터 삽입
직접 코드로 XML변환 하는 경우가 처음이므로 XML 변환 자체의 접근에 대한 어려움을 느꼈으며, 처음 형 변환에 대해 성공한 후에는 데이터 정합성에 대한 문제에 대한 고민을 많이 하게 되었다. 단건을 받는 경우가 아니라 Spring Schedular를 사용하여 주기적으로 대용량 데이터를 XML변환을 하였기 때문에 XML변환에만 한정된 기능이 아니었으며, 기본적인 OEPN API 활용 및 데이터 다루는거에 비해서 신경써야할 부분이 많았다. 처음에는 막막했지만 개발을 끝내고 나서는 새로운 기술이 아닌 기능에 대해 구현을 해냈다는 거에 대해서 만족그러운 경험이었다.