String text = rawValue == null ? null : rawValue.toString( );
	public void startForeign( IForeignContent foreign )	{		IStyle mergedStyle = foreign.getStyle( );		if ( peek( mergedStyle ) )		{			return;		}		logger.log( Level.FINE, "[HTMLReportEmitter] Start foreign" ); //$NON-NLS-1$		StringBuffer styleBuffer = new StringBuffer( );		DimensionType x = foreign.getX( );		DimensionType y = foreign.getY( );		DimensionType width = foreign.getWidth( );		DimensionType height = foreign.getHeight( );		int display;		display = checkElementType( x, y, width, height, mergedStyle,				styleBuffer );		// action		String tagName;		String selectHandleTag = null;		String url = validate( foreign.getHyperlinkAction( ) );		if ( url != null )		{			if ( enableMetadata )			{				// output select class				selectHandleTag = HTMLTags.TAG_SPAN;				writer.openTag( selectHandleTag );				writer.attribute( HTMLTags.ATTR_CLASS, "birt-foreign-design" ); //$NON-NLS-1$				setActiveIDTypeIID( foreign );				setBookmark( selectHandleTag, foreign.getBookmark( ) );			}			tagName = HTMLTags.TAG_A;			outputAction( foreign.getHyperlinkAction( ), url );			setDisplayProperty( display, DISPLAY_BLOCK | DISPLAY_INLINE_BLOCK,					styleBuffer );			AttributeBuilder.checkHyperlinkTextDecoration( mergedStyle,					styleBuffer );		}		else		{			if ( enableMetadata )			{				selectHandleTag = getTagByType( display, DISPLAY_FLAG_ALL );				writer.openTag( selectHandleTag );				writer.attribute( HTMLTags.ATTR_CLASS, "birt-foreign-design" ); //$NON-NLS-1$				setActiveIDTypeIID( foreign );				setBookmark( selectHandleTag, foreign.getBookmark( ) );			}			tagName = openTagByType( display, DISPLAY_FLAG_ALL );			setDisplayProperty( display, DISPLAY_INLINE_BLOCK, styleBuffer );		}		setStyleName( foreign.getStyleClass( ) );		// bookmark		if ( !enableMetadata )		{			outputBookmark( foreign, tagName );		}		// title		writer.attribute( HTMLTags.ATTR_TITLE, foreign.getHelpText( ) );		// check 'can-shrink' property		handleShrink( display, mergedStyle, height, width, styleBuffer );		handleStyle( foreign, styleBuffer, false );		Object rawValue = foreign.getRawValue( );		String rawType = foreign.getRawType( );		boolean isHtml = IForeignContent.HTML_TYPE.equalsIgnoreCase( rawType );		String text = rawValue == null ? null : rawValue.toString( );		if ( isHtml )		{			Document doc = new TextParser( ).parse( text,					TextParser.TEXT_TYPE_HTML );			ReportDesignHandle design = (ReportDesignHandle) runnable					.getDesignHandle( );			HTMLProcessor htmlProcessor = new HTMLProcessor( design );			HashMap styleMap = new HashMap( );			Element body = null;			if ( doc != null )			{				NodeList bodys = doc.getElementsByTagName( "body" );				if ( bodys.getLength( ) > 0 )				{					body = (Element) bodys.item( 0 );				}			}			if ( body != null )			{				htmlProcessor.execute( body, styleMap );				processNodes( body, styleMap );			}		}		// writer.text( text, !isHtml, !isHtml );		writer.closeTag( tagName );		if ( enableMetadata )		{			writer.closeTag( selectHandleTag );		}	}