src/main/java/org/jboss/loom/utils/XmlUtils.java
public static <T> T unmarshallBean( boolean must, File docFile, String xpath, Class<T> cls ) throws MigrationException{
        if( ! docFile.exists() ){
            if( must )  throw new MigrationException("File to unmarshall not found: " + docFile);
            else        return null;
        }
            
        List<T> beans = unmarshallBeans( docFile, xpath, cls );
        if( beans.isEmpty() )
            throw new MigrationException("XPath "+xpath+" returned no nodes from " + docFile);
        return beans.get(0);
    }
/**
     *  Read XML from the File, look for nodes by XPath, and unmarshall them into given Class.
     *  If Class is Origin.Wise, the origin is stored.
     */
Read XML from the File, look for nodes by XPath, and unmarshall them into given Class.
If Class is Origin.Wise, the origin is stored.
Read XML from the File look for nodes by XPath and unmarshall them into given Class . If Class is Origin . Wise the origin is stored .
public static <T> T unmarshallBean( boolean must, File docFile, String xpath, Class<T> cls ) throws MigrationException{
        if( ! docFile.exists() ){
            if( must )  throw new MigrationException("File to unmarshall not found: " + docFile);
            else        return null;
        }
        List<T> beans = unmarshallBeans( docFile, xpath, cls );
        if( beans.isEmpty() )
            throw new MigrationException("XPath "+xpath+" returned no nodes from " + docFile);
        return beans.get(0);
    }
public static < T > T unmarshallBean ( boolean must , File docFile , String xpath , Class < T > cls ) throws MigrationException { if ( ! docFile . exists ( ) ) { if ( must ) throw new MigrationException ( "File to unmarshall not found: " + docFile ) ; else return null ; } List < T > beans = unmarshallBeans ( docFile , xpath , cls ) ; if ( beans . isEmpty ( ) ) throw new MigrationException ( "XPath " + xpath + " returned no nodes from " + docFile ) ; return beans . get ( 0 ) ; }
Read XML from the File, look for nodes by XPath, and unmarshall them into given Class.
Read XML from the File look for nodes by XPath and unmarshall them into given Class .