ITextContent content )
ITextContent content, HTMLProcessor htmlProcessor )
	private void evaluateEmbeddedExpression( Node node, TextItemDesign text,			ITextContent content )	{		if ( node.getNodeType( ) == Node.ELEMENT_NODE )		{			Element ele = (Element) node;			if ( node.getNodeName( ).equals( "img" ) )			{				String src = ele.getAttribute( "src" );				if ( FileUtil.isLocalResource( src ) )				{					src = FileUtil.getAbsolutePath( context.getReport( )							.getBasePath( ), src );					ele.removeAttribute( "src" );					IImageItemContent imgContent = ContentFactory							.createImageContent( null );					content.addImageContent( node, imgContent );					imgContent.setImageSource( ImageItemDesign.IMAGE_FILE );					imgContent.setUri( src );					imgContent.setExtension( FileUtil.getExtFromFileName( src,							FileUtil.SEPARATOR_PATH ) );				}			}			else if ( node.getNodeName( ).equals( "value-of" ) )			{				// If there are more than one child node, it must have and only				// have two children nodes, remove the last child node.				if ( node.getChildNodes( ).getLength( ) > 1 )				{					node.removeChild( node.getLastChild( ) );				}				String strExpr = node.getFirstChild( ).getNodeValue( );				IBaseExpression expr = text.getExpression( strExpr );				Object value;				if ( expr != null )				{					value = context.evaluate( expr );				}				else				{					value = context.evaluate( strExpr );				}				if ( value != null )				{					String format = ( (Element) ( node ) )							.getAttribute( "format" );					Node appendedNode = null;					//TODO Only the type string and blob are done in the format					// of HTML, or else only string type.					if ( "html".equals( format ) )					{						//parse the value to get the DOM tree						Document doc = null;						if ( value.getClass( ).isArray( )								&& value.getClass( ).getComponentType( ) == byte.class )						{							byte[] blob = (byte[]) value;							doc = new TextParser( ).parse(									new ByteArrayInputStream( blob ), "html" );						}						else						{							doc = new TextParser( ).parse( value.toString( ),									"html" );						}						appendedNode = node.getOwnerDocument( ).createElement(								"body" );						copyChildrenNodes( doc.getFirstChild( ), appendedNode );					}					else					{						StringBuffer formattedStr = new StringBuffer( );						//Uses the ROM style of design because the						// format-related styles are constant, which are the						// same as those of the content.						formatValue( value, format, text.getStyle( ),								formattedStr );						appendedNode = node.getOwnerDocument( ).createElement(								"body" );						appendedNode.appendChild( node.getOwnerDocument( )								.createTextNode( formattedStr.toString( ) ) );					}					node.appendChild( appendedNode );				}				return;			}			else if ( node.getNodeName( ).equals( "image" ) )			{				//For the embedded image, this node does not have child node				// before evaluating. But for the expression, the node has a				// text-type node holding the expression. So we must find the				// value node dependent on the different situations and remove				// it.				if ( node.getChildNodes( ).getLength( ) > 0						&& node.getLastChild( ).getNodeType( ) == Node.ELEMENT_NODE )				{					node.removeChild( node.getLastChild( ) );				}				Node body = node.getOwnerDocument( ).createElement( "body" );				Element imgNode = node.getOwnerDocument( )						.createElement( "img" );				IImageItemContent image = ContentFactory.createImageContent( null );				//Get the image content				String imageType = ( (Element) ( node ) ).getAttribute( "type" );				if ( "expr".equalsIgnoreCase( imageType ) )				{					image.setImageSource( ImageItemDesign.IMAGE_EXPRESSION );					//The image is from data source					String strExpression = node.getFirstChild( ).getNodeValue( );					Object value = context.evaluate( text							.getExpression( strExpression ) );					if ( value != null							&& value.getClass( ).isArray( )							&& value.getClass( ).getComponentType( ) == byte.class )					{						image.setData( (byte[]) value );					}					//Note: Actually the type just means that the image is from					// the data source and there is not an attribute indicating					// the file type.					/*					 * fileExt = (String) context.evaluate( text .getExpression(					 * imageType ) );					 */				}				else				{					//The image is an embedded one.					String name = ( (Element) ( node ) ).getAttribute( "name" );					EmbeddedImage embeddedImage = context.getReport( )							.getReportDesign( ).findImage( name );					if ( embeddedImage != null )					{						image.setData( embeddedImage.getData( ) );						image.setImageSource( ImageItemDesign.IMAGE_NAME );						image.setUri( name );						String extension = FileUtil								.getExtFromType( embeddedImage.getType( ) );						if ( extension == null )						{							extension = FileUtil.getExtFromFileName( name,									FileUtil.SEPARATOR_PATH );						}						image.setExtension( extension );					}				}				if ( image.getData( ) != null )				{					content.addImageContent( imgNode, image );					// add image node to DOM tree					body.appendChild( imgNode );					node.appendChild( body );				}				else				{				    logger.log(Level.SEVERE, "can't handle image element in HTML" );				}				return;			}			// call recursively			for ( Node child = node.getFirstChild( ); child != null; child = child					.getNextSibling( ) )			{				evaluateEmbeddedExpression( child, text, content );			}		}	}