try { SAXParserFactory saxParserFactory = SAXParserFactory.newInstance( ); SAXParser parser = saxParserFactory.newSAXParser( ); InputSource inputSource = new InputSource( streamData ); inputSource.setEncoding( UnicodeUtil.SIGNATURE_UTF_8 ); parser.parse( inputSource, handler ); } catch ( SAXException e ) { List errors = handler.getErrorHandler( ).getErrors( );    if ( e.getException( ) instanceof DesignFileException ) { throw (DesignFileException) e.getException( ); }    throw new DesignFileException( null, errors, e ); } catch ( ParserConfigurationException e ) { throw new DesignFileException( null, handler.getErrorHandler( ) .getErrors( ), e ); } catch ( IOException e ) { throw new DesignFileException( null, handler.getErrorHandler( ) .getErrors( ), e ); }
parse( handler, streamData );
	public static ActionHandle deserializeAction( InputStream streamData )			throws DesignFileException	{		// A fake element with the given action. Used to reuse the existing		// action parser logic.		ImageItem image = new ImageItem( );		ActionParserHandler handler = new ActionParserHandler( image );		if ( streamData == null )		{			Action action = StructureFactory.createAction( );			image.setProperty( ImageHandle.ACTION_PROP, action );			return ( (ImageHandle) image.getHandle( handler.getModule( ) ) )					.getActionHandle( );		}		if ( !streamData.markSupported( ) )			streamData = new BufferedInputStream( streamData );		assert streamData.markSupported( );		try		{			SAXParserFactory saxParserFactory = SAXParserFactory.newInstance( );			SAXParser parser = saxParserFactory.newSAXParser( );			InputSource inputSource = new InputSource( streamData );			inputSource.setEncoding( UnicodeUtil.SIGNATURE_UTF_8 );			parser.parse( inputSource, handler );		}		catch ( SAXException e )		{			List errors = handler.getErrorHandler( ).getErrors( );			// Syntax error is found			if ( e.getException( ) instanceof DesignFileException )			{				throw (DesignFileException) e.getException( );			}			// Invalid xml error is found			throw new DesignFileException( null, errors, e );		}		catch ( ParserConfigurationException e )		{			throw new DesignFileException( null, handler.getErrorHandler( )					.getErrors( ), e );		}		catch ( IOException e )		{			throw new DesignFileException( null, handler.getErrorHandler( )					.getErrors( ), e );		}		ImageHandle imageHandle = (ImageHandle) image.getHandle( handler				.getModule( ) );		return imageHandle.getActionHandle( );	}