Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/tool/XHtmlTagTool.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/tool/XHtmlTagTool.java	(revision 1435)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/tool/XHtmlTagTool.java	(revision 1436)
@@ -25,68 +25,91 @@
 
 /**
- * Tool to construct a XHTML-tag.
- *
+ * Tool to construct a XHTML-tag.<br>
+ * <br>
+ * Usage:
+ * <pre>
+ * XHtmlTagTool tag = XHtmlTagTool(&quot;a&quot;, &quot;link&quot;);
+ * tag.addAttribute(&quot;href&quot;, &quot;http://google.com&quot;);
+ * tag.toString();	: &lt;a href=&quot;http://google.com&quot;&gt;link&lt;/a&gt;
+ * </pre>
+ * 
+ * Hint:
+ * <ul>
+ * <li>Attributes are not ordered.</li>
+ * <li>If your tag shouldn't have a value but the tag has to close with '&lt;/[tagname]&gt;', set
+ * the value to an empty string.</li>
+ * </ul>
+ * 
  * @version $Id$
  */
 public class XHtmlTagTool {
-    
-    /** name of the tag */
-    private String name;
-       
-    /** container for the attributes */
-    private Map<String, String> attributes = new HashMap<String, String>();
-        
-    /** value of the tag. if value='' tag will be close simalary value is set */
-    private String value = null;
-    
-    
-    
-    public XHtmlTagTool(final String name) {
-	this(name, null);
-    }
-    
-    public XHtmlTagTool(final String name, final String value) {
-	if (Utils.isEmpty(name))
-	    throw new IllegalArgumentException("Parameter 'name' shouldn't be null!");
-	this.name = name;
-	this.value = value;
-    }
-    
-    
-    
-    public void setValue(final String value) {
-	this.value = value;
-    }
-    
-    public void addAttribute(final String key, final String value) {
-	attributes.put(key, value);
-    }
 
+	/** Name of the tag. */
+	private String name;
 
-    /**
-     * Constructs the tag.
-     * 
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    public String toString() {
-	StringBuilder tag = new StringBuilder();
-	
-	// open tag
-	tag.append("<").append(name);
-	
-	// add attributes
-	for (String key : attributes.keySet()) {
-	    String val = attributes.get(key);
-	    tag.append(' ').append(key).append('=').append('\"').append(val).append('\"');
+	/** Container for the attributes. */
+	private Map<String, String> attributes = new HashMap<String, String>();
+
+	/** Value of the tag. If value='' tag will be close similarly value is set. */
+	private String value = null;
+
+	public XHtmlTagTool(final String name, final String value) throws IllegalArgumentException {
+		if (Utils.isEmpty(name))
+			throw new IllegalArgumentException("Parameter 'name' shouldn't be null!");
+		this.name = name;
+		this.value = value;
 	}
-	
-	// close the tag
-	if (Utils.isNotEmpty(value)) {
-	    tag.append(">").append(value).append("</").append(name).append('>');
-	} else
-	    tag.append("/>");
-	
-	return tag.toString();
-    }
+
+	public XHtmlTagTool(final String name) {
+		this(name, null);
+	}
+
+	/**
+	 * Setter for the value of the tag.
+	 * 
+	 * @param value
+	 */
+	public void setValue(final String value) {
+		this.value = value;
+	}
+
+	/**
+	 * Adds an attribute to the tag.
+	 * 
+	 * @param key
+	 * @param value
+	 * @throws IllegalArgumentException if 'key' is empty.
+	 */
+	public void addAttribute(final String key, final String value) {
+		if (Utils.isEmpty(key))
+			throw new IllegalArgumentException("Parameter 'key' shouldn't be empty!");
+		attributes.put(key, value);
+	}
+
+	/**
+	 * Constructs the tag.
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		StringBuilder tag = new StringBuilder();
+
+		// open tag
+		tag.append("<").append(name);
+
+		// add attributes
+		for (String key : attributes.keySet()) {
+			String val = attributes.get(key);
+			tag.append(' ').append(key).append('=').append('\"').append(val).append('\"');
+		}
+
+		// close the tag
+		if (Utils.isNotEmpty(value)) {
+			tag.append(">").append(value).append("</").append(name).append('>');
+		} else
+			tag.append("/>");
+
+		return tag.toString();
+	}
 }
