Java XML JAXB Unserialize parseXml(final Class klass, final Reader xmlReader)

Here you can find the source of parseXml(final Class klass, final Reader xmlReader)

Description

parse Xml

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static <K> K parseXml(final Class<K> klass, final Reader xmlReader) throws Exception 

Method Source Code


//package com.java2s;
import java.io.Reader;
import javax.xml.bind.JAXBContext;

public class Main {
    @SuppressWarnings("unchecked")
    public static <K> K parseXml(final Class<K> klass, final Reader xmlReader) throws Exception {
        JAXBContext context = JAXBContext.newInstance(klass);
        return (K) context.createUnmarshaller().unmarshal(xmlReader);
    }//from   w  w w.j a va  2 s  . c  om
}

Related

  1. loadXML(Object object, String fileNamePath)
  2. loadXMLFromString(Object object, String line)
  3. parse(final Class clazz, final InputStream inputStream)
  4. parseIsoDate(String lexicalDate)
  5. parseJaxb(Class cls, InputStream in)
  6. parseXML(String content, Class clazz)
  7. parseXmlFile(Class type, String filePath)
  8. read(Class cl, InputStream is)
  9. read(File file, Class typeParameterClass)