private TldInfo scanTld ( String resourcePath , String entryName , InputStream stream ) throws JasperException { try { // Parse the tag library descriptor at the specified resource path TreeNode tld = new ParserUtils ( ) . parseXMLDocument ( resourcePath , stream , isValidationEnabled ) ; String uri = null ; TreeNode uriNode = tld . findChild ( "uri" ) ; if ( uriNode != null ) { uri = uriNode . getBody ( ) ; } ArrayList < String > listeners = new ArrayList < String > ( ) ; Iterator < TreeNode > listenerNodes = tld . findChildren ( "listener" ) ; while ( listenerNodes . hasNext ( ) ) { TreeNode listener = listenerNodes . next ( ) ; TreeNode listenerClass = listener . findChild ( "listener-class" ) ; if ( listenerClass != null ) { String listenerClassName = listenerClass . getBody ( ) ; if ( listenerClassName != null ) { listeners . add ( listenerClassName ) ; } } } return new TldInfo ( uri , entryName , listeners . toArray ( new String [ listeners . size ( ) ] ) ) ; } finally { if ( stream != null ) { try { stream . close ( ) ; } catch ( Throwable t ) { // do nothing } } } }
Scan the given TLD for uri and listeners elements .