SQLXML
SQLXML (SQL XML 매핑)
SQL XML 타입을 Java 프로그래밍 언어로 매핑한 것입니다. XML은 XML 값을 데이터베이스 테이블 행의 열 값으로 저장하는 내장 타입이에요. 기본적으로 드라이버는 SQLXML 객체를 XML 데이터 자체가 아니라 XML 데이터에 대한 논리적 포인터로 구현합니다.
본문
SQLXML 객체는 생성된 트랜잭션 기간 동안 유효합니다. SQLXML 인터페이스는 XML 값을 String, Reader 또는 Writer, 또는 Stream으로 접근하는 메서드를 제공합니다. XML 값은 Source로 접근하거나 Result로 설정할 수도 있으며, 이는 DOM, SAX, StAX 같은 XML 파서 API와 XSLT 변환, XPath 평가에 사용됩니다.
DB는 XML에 대해 최적화된 표현을 사용할 수 있으므로, getSource()와 setResult()로 값을 접근하면 스트림 표현으로 직렬화해 파싱하지 않고도 처리 성능을 향상시킬 수 있어요. 예를 들어 DOM Document 노드를 얻으려면:
DOMSource domSource = sqlxml.getSource(DOMSource.class);
Document document = (Document) domSource.getNode();
대표적인 메서드
void free() throws SQLException
InputStream getBinaryStream() throws SQLException
OutputStream setBinaryStream() throws SQLException
Reader getCharacterStream() throws SQLException
Writer setCharacterStream() throws SQLException
String getString() throws SQLException
void setString(String value) throws SQLException
<T extends Source> T getSource(Class<T> sourceClass) throws SQLException
<T extends Result> T setResult(Class<T> resultClass) throws SQLException