unmarshallerhandler.html

来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 268 行

HTML
268
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_14) on Mon Jan 28 05:46:59 PST 2008 --><TITLE>UnmarshallerHandler (Java EE 5)</TITLE><META NAME="keywords" CONTENT="javax.xml.bind.UnmarshallerHandler interface"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="UnmarshallerHandler (Java EE 5)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../javax/xml/bind/Unmarshaller.Listener.html" title="class in javax.xml.bind"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../javax/xml/bind/ValidationEvent.html" title="interface in javax.xml.bind"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html?javax/xml/bind/UnmarshallerHandler.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="UnmarshallerHandler.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.xml.bind</FONT><BR>Interface UnmarshallerHandler</H2><DL><DT><B>All Superinterfaces:</B> <DD><A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html" title="class or interface in org.xml.sax">ContentHandler</A></DD></DL><HR><DL><DT><PRE>public interface <B>UnmarshallerHandler</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html" title="class or interface in org.xml.sax">ContentHandler</A></DL></PRE><P>Unmarshaller implemented as SAX ContentHandler.  <p> Applications can use this interface to use their JAXB provider as a component  in an XML pipeline.  For example:  <pre>       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();                           </pre>  <p> This interface is reusable: even if the user fails to unmarshal an object, s/he can still start a new round of unmarshalling.<P><P><DL><DT><B>Since:</B></DT>  <DD>JAXB1.0</DD><DT><B>Version:</B></DT>  <DD>$Revision: 1.2 $ $Date: 2006/03/08 16:55:17 $</DD><DT><B>Author:</B></DT>  <DD><ul><li>Kohsuke KAWAGUCHI, Sun Microsystems, Inc.</li></ul></DD><DT><B>See Also:</B><DD><A HREF="../../../javax/xml/bind/Unmarshaller.html#getUnmarshallerHandler()"><CODE>Unmarshaller.getUnmarshallerHandler()</CODE></A></DL><HR><P><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/bind/UnmarshallerHandler.html#getResult()">getResult</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Obtains the unmarshalled result.</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_org.xml.sax.ContentHandler"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from interface org.xml.sax.<A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html" title="class or interface in org.xml.sax">ContentHandler</A></B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#characters(char[], int, int)" title="class or interface in org.xml.sax">characters</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#endDocument()" title="class or interface in org.xml.sax">endDocument</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#endElement(java.lang.String, java.lang.String, java.lang.String)" title="class or interface in org.xml.sax">endElement</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#endPrefixMapping(java.lang.String)" title="class or interface in org.xml.sax">endPrefixMapping</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#ignorableWhitespace(char[], int, int)" title="class or interface in org.xml.sax">ignorableWhitespace</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#processingInstruction(java.lang.String, java.lang.String)" title="class or interface in org.xml.sax">processingInstruction</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#setDocumentLocator(org.xml.sax.Locator)" title="class or interface in org.xml.sax">setDocumentLocator</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#skippedEntity(java.lang.String)" title="class or interface in org.xml.sax">skippedEntity</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#startDocument()" title="class or interface in org.xml.sax">startDocument</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)" title="class or interface in org.xml.sax">startElement</A>, <A HREF="http://java.sun.com/j2se/1.5/docs/api/org/xml/sax/ContentHandler.html#startPrefixMapping(java.lang.String, java.lang.String)" title="class or interface in org.xml.sax">startPrefixMapping</A></CODE></TD></TR></TABLE>&nbsp;<P><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="getResult()"><!-- --></A><H3>getResult</H3><PRE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <B>getResult</B>()                 throws <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A>,                        <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></PRE><DL><DD>Obtains the unmarshalled result.  This method can be called only after this handler receives the endDocument SAX event.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>always return a non-null valid object which was unmarshalled.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this method is called before this handler      receives the endDocument event.<DD><CODE><A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></CODE> - if there is any unmarshalling error.      Note that the implementation is allowed to throw SAXException      during the parsing when it finds an error.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../javax/xml/bind/Unmarshaller.Listener.html" title="class in javax.xml.bind"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../javax/xml/bind/ValidationEvent.html" title="interface in javax.xml.bind"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html?javax/xml/bind/UnmarshallerHandler.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="UnmarshallerHandler.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1"><a href="http://java.sun.com/webapps/bugreport">Submit a bug or feature</a> <p>Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../legal/license.html" target="_top">license terms.</a></font></BODY></HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?