context.addErrorMsg( "Fails to handle Text " + item.getName( ) + ":" + t.getLocalizedMessage( ) );
	public void execute( ReportItemDesign item, IReportEmitter emitter )	{		TextItemDesign textItem = (TextItemDesign) item;		IReportItemEmitter textEmitter = emitter.getEmitter( "text" ); //$NON-NLS-1$		if ( textEmitter == null )		{			return;		}		TextItemContent textContent = (TextItemContent) ContentFactory				.createTextContent( textItem, context.getContentObject( ) );		IResultSet rs = null;		try		{			rs = openResultSet( item );			if ( rs != null )			{				rs.next( );			}						setStyles( textContent, item );			setVisibility( item, textContent );			//Checks if the content has been parsed before. If so, use the DOM			// tree			// directly to improve performance. In addition to the DOM tree, the			// CSS			// style is also a part of the parsed content. Or else, parse the			// content and save the DOM tree and CSS style in the Text item			// design.			HTMLProcessor htmlProcessor = new HTMLProcessor( context );			if ( textItem.getDomTree( ) == null )			{				//Only when the Text is in the master page.				//Because ExpressionBuilder has parsed the content. And the				// style				// has not been extracted yet.				String content = getLocalizedString( textItem.getTextKey( ),						textItem.getText( ) );				textItem.setDomTree( new TextParser( ).parse( content, textItem						.getTextType( ) ) );				textContent.setDomTree( textItem.getDomTree( ) );			}			Document doc = textItem.getDomTree( );			Element body = null;			if ( doc != null )			{				Node node = doc.getFirstChild( );				//The following must be true				if ( node instanceof Element )				{					body = (Element) node;				}			}			if ( body != null )			{				//Checks if the DOM can be reused here. If no, then convert the				// DOM				// tree.				if ( !textItem.isReused( ) )				{					htmlProcessor.execute( body, textContent );					//Saves the CSS style associated with the original text					// content					textItem.setCssStyleSet( textContent.getCssStyleSet( ) );					textItem.setReused( true );				}				evaluateEmbeddedExpression( body, textItem, textContent,						htmlProcessor );			}			String bookmarkStr = evalBookmark( textItem );			if ( bookmarkStr != null )			{				textContent.setBookmarkValue( bookmarkStr );			}			textEmitter.start( textContent );			textEmitter.end( );		}		catch ( Throwable t )		{			logger.log( Level.SEVERE, "Error:", t );//$NON-NLS-1$		}		finally		{			closeResultSet( rs );		}			}