JavaTM Platform
Standard Ed. 6

javax.xml.bind
인터페이스 UnmarshallerHandler

모든 슈퍼 인터페이스:
ContentHandler


public interface UnmarshallerHandler
extends ContentHandler

SAX ContentHandler 로서 구현된 Unmarshaller.

어플리케이션은, 이 인터페이스를 사용해 그 JAXB 프로바이더를 XML 파이프라인의 컴퍼넌트로서 사용할 수 있습니다. 다음에 예를 나타냅니다.

       JAXBContext context = JAXBContext.newInstance( "org.acme.foo" );

       Unmarshaller unmarshaller = context.createUnmarshaller();
 
       UnmarshallerHandler unmarshallerHandler = unmarshaller.getUnmarshallerHandler();

       SAXParserFactory spf = SAXParserFactory.newInstance();
       spf.setNamespaceAware( true );
 
       XMLReader xmlReader = spf.newSAXParser(). getXMLReader();
       xmlReader.setContentHandler( unmarshallerHandler );
       xmlReader.parse(new InputSource( new FileInputStream( XML_FILE ) ) );

       MyObject myObject= (MyObject) unmarshallerHandler.getResult();                          
 

이 인터페이스는 재사용 가능합니다. 사용자가 객체를 비정렬화할 수 없었던 경우에서도, 비정렬화의 새로운 라운드를 개시할 수가 있습니다.

도입된 버젼:
JAXB1. 0
관련 항목:
Unmarshaller.getUnmarshallerHandler()

메소드의 개요
 Object getResult ()
          비정렬화 된 결과를 가져옵니다.
 
인터페이스 org.xml.sax. ContentHandler 로부터 상속된 메소드
characters , endDocument , endElement , endPrefixMapping , ignorableWhitespace , processingInstruction , setDocumentLocator , skippedEntity , startDocument , startElement , startPrefixMapping
 

메소드의 상세

getResult

Object  getResult()
                 throws JAXBException ,
                        IllegalStateException 
비정렬화 된 결과를 가져옵니다. 이 핸들러가 endDocument SAX 이벤트를 받은 후만, 이 메소드를 호출할 수가 있습니다.

반환값:
항상 비정렬화 된 null 이외의 유효한 객체를 돌려준다
예외:
IllegalStateException - 이 핸들러가 endDocument 이벤트를 받기 전에 이 메소드가 불려 갔을 경우
JAXBException - 비정렬화 에러가 존재하는 경우. 이 구현은, 구문 분석중에 에러를 검출했을 경우, SAXException 를 throw 하는 것을 허가되고 있다

JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.