public static ApplicationConfiguration load ( InputStream input ) throws Exception { XMLStreamReader xml = XMLInputFactory . newFactory ( ) . createXMLStreamReader ( input ) ; while ( xml . hasNext ( ) ) { xml . next ( ) ; if ( xml . getEventType ( ) == XMLStreamConstants . START_ELEMENT ) { if ( ! "project" . equals ( xml . getLocalName ( ) ) ) throw new Exception ( "Root element of an lc-project.xml file must be <project>" ) ; ApplicationConfiguration cfg = new ApplicationConfiguration ( ) ; boolean found = false ; while ( xml . hasNext ( ) ) { xml . next ( ) ; if ( xml . getEventType ( ) == XMLStreamConstants . START_ELEMENT ) { if ( "application" . equals ( xml . getLocalName ( ) ) ) { found = true ; cfg . load ( xml ) ; break ; } } } if ( ! found ) throw new Exception ( "No application element found in lc-project.xml file" ) ; return cfg ; } } throw new Exception ( "Nothing found in lc-project.xml file" ) ; }
Load from the given stream .