src/main/java/de/alpharogroup/xml/tag/SimpleTag.java
public StringBuilder toVelocityTemplate()
	{
		final StringBuilder buffer = new StringBuilder();
		buffer.append("<");
		buffer.append("${").append(getName()).append(".name}\n");
		if (getAttributes() != null && !getAttributes().isEmpty())
		{
			buffer.append(" #foreach(" + "$attribute in $").append(getName())
				.append(".attributes.keySet()" + ")\n");
			buffer.append("$attribute=\"$").append(getName())
				.append(".getAttributes().get($attribute)\"\n");
			buffer.append(" #end\n");
		}
		buffer.append("#if(${").append(getName()).append(".endTag})>${").append(getName())
			.append(".content}\n");
		if (getChildren() != null && !getChildren().isEmpty())
		{
			buffer.append("#foreach($").append(getChildren().get(0).getName()).append(" in $")
				.append(getName()).append(".children)\n");
			for (final SimpleTag child : getChildren())
			{
				buffer.append(child.toVelocityTemplate().toString());
			}
			buffer.append("#end\n");
		}
		buffer.append("</${").append(getName()).append(".name}>\n");
		buffer.append("#else />\n" + "#end\n");
		return buffer;
	}
public StringBuilder toVelocityTemplate()
	{
		final StringBuilder buffer = new StringBuilder();
		buffer.append("<");
		buffer.append("${").append(getName()).append(".name}\n");
		if (getAttributes() != null && !getAttributes().isEmpty())
		{
			buffer.append(" #foreach(" + "$attribute in $").append(getName())
				.append(".attributes.keySet()" + ")\n");
			buffer.append("$attribute=\"$").append(getName())
				.append(".getAttributes().get($attribute)\"\n");
			buffer.append(" #end\n");
		}
		buffer.append("#if(${").append(getName()).append(".endTag})>${").append(getName())
			.append(".content}\n");
		if (getChildren() != null && !getChildren().isEmpty())
		{
			buffer.append("#foreach($").append(getChildren().get(0).getName()).append(" in $")
				.append(getName()).append(".children)\n");
			for (final SimpleTag child : getChildren())
			{
				buffer.append(child.toVelocityTemplate().toString());
			}
			buffer.append("#end\n");
		}
		buffer.append("</${").append(getName()).append(".name}>\n");
		buffer.append("#else />\n" + "#end\n");
		return buffer;
	}
public StringBuilder toVelocityTemplate ( ) { final StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( "<" ) ; buffer . append ( "${" ) . append ( getName ( ) ) . append ( ".name}\n" ) ; if ( getAttributes ( ) != null && ! getAttributes ( ) . isEmpty ( ) ) { buffer . append ( " #foreach(" + "$attribute in $" ) . append ( getName ( ) ) . append ( ".attributes.keySet()" + ")\n" ) ; buffer . append ( "$attribute=\"$" ) . append ( getName ( ) ) . append ( ".getAttributes().get($attribute)\"\n" ) ; buffer . append ( " #end\n" ) ; } buffer . append ( "#if(${" ) . append ( getName ( ) ) . append ( ".endTag})>${" ) . append ( getName ( ) ) . append ( ".content}\n" ) ; if ( getChildren ( ) != null && ! getChildren ( ) . isEmpty ( ) ) { buffer . append ( "#foreach($" ) . append ( getChildren ( ) . get ( 0 ) . getName ( ) ) . append ( " in $" ) . append ( getName ( ) ) . append ( ".children)\n" ) ; for ( final SimpleTag child : getChildren ( ) ) { buffer . append ( child . toVelocityTemplate ( ) . toString ( ) ) ; } buffer . append ( "#end\n" ) ; } buffer . append ( "</${" ) . append ( getName ( ) ) . append ( ".name}>\n" ) ; buffer . append ( "#else />\n" + "#end\n" ) ; return buffer ; }
Creates from this Tag object an velocity template as String object. It puts children Tag
object in the template recursively.

@return the string buffer
Creates from this Tag object an velocity template as String object . It puts children Tag object in the template recursively .