Java tutorial
//package com.java2s; public class Main { public static StringBuilder attribute(StringBuilder builder, String type, String name, String value) { builder.append("<dia:attribute name=\"").append(name); builder.append("\"><dia:").append(type).append(" val=\""); builder.append(value); builder.append("\"/></dia:attribute>"); return builder; } public static StringBuilder attribute(StringBuilder builder, String name) { return builder.append("<dia:attribute name=\"").append(name).append("\"/>"); } }