/** * Reads in a Java object tree from the given XML input. * * @param xml * Reads the entire file as XML. */ public static <T> T unmarshal( File xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(new StreamSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * The XML infoset that the {@link Source} represents is read. */ public static <T> T unmarshal( Source xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } catch (IOException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * The resource pointed by the URL is read in its entirety. */ public static <T> T unmarshal( URL xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } catch (IOException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * The URI is {@link URI#toURL() turned into URL} and then * follows the handling of {@code URL}. */ public static <T> T unmarshal( URI xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } catch (IOException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * The entire stream is read as an XML infoset. * Upon a successful completion, the stream will be closed by this method. */ public static <T> T unmarshal( InputStream xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } catch (IOException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * The string is first interpreted as an absolute {@code URI}. * If it's not {@link URI#isAbsolute() a valid absolute URI}, * then it's interpreted as a {@code File} */ public static <T> T unmarshal( String xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } catch (IOException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * The character stream is read as an XML infoset. * The encoding declaration in the XML will be ignored. * Upon a successful completion, the stream will be closed by this method. */ public static <T> T unmarshal( Reader xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } catch (IOException e) { throw new DataBindingException(e); } }
context = getContext(((JAXBElement<?>)jaxbObject).getDeclaredType()); } else { Class<?> clazz = jaxbObject.getClass(); XmlRootElement r = clazz.getAnnotation(XmlRootElement.class); context = getContext(clazz); if(r==null) {
public static <T> T unmarshal(Source source, Class<T> type) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(source, type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
public static <T> T unmarshal(Source source, Class<T> type) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(source, type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
public static <T> T unmarshal(Source source, Class<T> type) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(source, type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * Reads the entire file as XML. */ public static <T> T unmarshal( File xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(new StreamSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * Reads the entire file as XML. */ public static <T> T unmarshal( File xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(new StreamSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * Reads the entire file as XML. */ public static <T> T unmarshal( File xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(new StreamSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * Reads the entire file as XML. */ public static <T> T unmarshal( File xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(new StreamSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * Reads the entire file as XML. */ public static <T> T unmarshal( File xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(new StreamSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * Reads the entire file as XML. */ public static <T> T unmarshal( File xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(new StreamSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * Reads the entire file as XML. */ public static <T> T unmarshal( File xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(new StreamSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * Reads the entire file as XML. */ public static <T> T unmarshal( File xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(new StreamSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } }
/** * Reads in a Java object tree from the given XML input. * * @param xml * The XML infoset that the {@link Source} represents is read. */ public static <T> T unmarshal( Source xml, Class<T> type ) { try { JAXBElement<T> item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); return item.getValue(); } catch (JAXBException e) { throw new DataBindingException(e); } catch (IOException e) { throw new DataBindingException(e); } }