데이터

  • csv
    • 컴마로 구분
    • 작지만 구조적이지 않음
  • xml
    • 태그를 통한 데이터 형식
    • 구조적이지만 정확한 문법, 큰용량
  • json
    • javascript object notation
    • 구조적, 다른 언어와 호환

xml

  • wellformed
    • 아래 형식이 되어있는지
    • root가 존재
    • 시작,끝 일치
    • 태그는 key-value구조의 속성을 가짐
    • 대소문자 구분
  • valid
    • 작성자 의도대로 되어있는지
    • dtd, scheaf로 규칙 확인

파서

SAX

  • 읽으면서 처리
  • 빠름, 다양한 탐색 어려움
  • 문서시작, 문서끝, 태그시작, 태그끝으로 이벤트 확인
  • defaultHandler를 extends(상속)해야한다.

simpledateformat format = new simpledateformat(yyy-mm-dd) format.parse(date)

startElement의 qname으로 특정 태그를 찾는다.

DOM

  • 다읽고 저장
  • 느리지만, 다양한 탐색 가능
  • domtree를 만든다.
  • root를 기준으로 부모 자식 관계

json

  • 객체를 key-value로

Map<String, Map<String,Object» list = mapper.readValue(json,map.class) list