Index: /FCKeditor.Java/trunk/java-core/pom.xml
===================================================================
--- /FCKeditor.Java/trunk/java-core/pom.xml	(revision 3519)
+++ /FCKeditor.Java/trunk/java-core/pom.xml	(revision 3520)
@@ -54,4 +54,10 @@
 			<artifactId>slf4j-nop</artifactId>
 			<version>${slf4j.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.mockito</groupId>
+			<artifactId>mockito-all</artifactId>
+			<version>1.7</version>
 			<scope>test</scope>
 		</dependency>
Index: /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/FCKeditor.java
===================================================================
--- /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/FCKeditor.java	(revision 3519)
+++ /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/FCKeditor.java	(revision 3520)
@@ -76,5 +76,7 @@
 	 *            the base path of the editor, absolute to the context
 	 * @throws IllegalArgumentException
-	 *             if instanceName is not a valid HTML id
+	 *             if instanceName is not a valid XHTML id
+	 * @throws IllegalArgumentException
+	 *             if instanceName is empty
 	 */
 	public FCKeditor(final HttpServletRequest request,
@@ -102,4 +104,6 @@
 	 * @throws IllegalArgumentException
 	 *             if instanceName is not a valid HTML id
+	 * @throws IllegalArgumentException
+	 *             if instanceName is empty
 	 */
 	public FCKeditor(final HttpServletRequest request, final String instanceName) {
@@ -109,9 +113,5 @@
 		this.request = request;
 
-		if (Utils.isBlank(instanceName))
-			throw new IllegalArgumentException(
-					"instanceName must be a valid HTML id");
-
-		this.instanceName = instanceName;
+		setInstanceName(instanceName);
 		
 	}
@@ -123,10 +123,14 @@
 	 *            the unique name of this editor
 	 * @throws IllegalArgumentException
-	 *             if instanceName is not a valid HTML id
+	 *             if instanceName is not a valid XHTML id
+	 * @throws IllegalArgumentException
+	 *             if instanceName is empty
 	 */
 	public void setInstanceName(final String instanceName) {
-		if (Utils.isBlank(instanceName))
+		if (Utils.isEmpty(instanceName))
+			throw new IllegalArgumentException("instanceName cannot be empty");
+		if (!instanceName.matches("[A-Za-z][A-Za-z0-9:_.-]*"))
 			throw new IllegalArgumentException(
-					"instanceName must be a valid HTML id");
+					"instanceName must be a valid XHTML id containing only [A-Za-z][A-Za-z0-9:_.-]*");
 		this.instanceName = instanceName;
 	}
Index: /FCKeditor.Java/trunk/java-core/src/test/java/net/fckeditor/FCKeditorTest.java
===================================================================
--- /FCKeditor.Java/trunk/java-core/src/test/java/net/fckeditor/FCKeditorTest.java	(revision 3520)
+++ /FCKeditor.Java/trunk/java-core/src/test/java/net/fckeditor/FCKeditorTest.java	(revision 3520)
@@ -0,0 +1,50 @@
+package net.fckeditor;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Test;
+import static org.mockito.Mockito.*;
+
+public class FCKeditorTest {
+	
+	@Test(expected = NullPointerException.class)
+	public void testNullRequest() {
+		new FCKeditor(null, "name");
+	}
+	
+	@Test(expected = IllegalArgumentException.class)
+	public void testEmptyInstanceName() {
+		HttpServletRequest request = mock(HttpServletRequest.class);
+		
+		new FCKeditor(request, null);
+	}
+	
+	@Test(expected = IllegalArgumentException.class)
+	public void testEmptyInstanceName02() {
+		HttpServletRequest request = mock(HttpServletRequest.class);
+		
+		new FCKeditor(request, "");
+	}
+	
+	@Test(expected = IllegalArgumentException.class)
+	public void testIllegalInstanceName() {
+		HttpServletRequest request = mock(HttpServletRequest.class);
+		
+		new FCKeditor(request, "my instance");
+	}
+	
+	@Test(expected = IllegalArgumentException.class)
+	public void testIllegalInstanceName02() {
+		HttpServletRequest request = mock(HttpServletRequest.class);
+		
+		new FCKeditor(request, "01_instance");
+	}
+	
+	@Test
+	public void testValidInstanceName() {
+		HttpServletRequest request = mock(HttpServletRequest.class);
+		
+		new FCKeditor(request, "myInstance");
+	}
+
+}
