From: Giovanni Mascellani <gio@debian.org>
Subject: Substitute for XMLCharacterProperties.java

The original file is not compatible with LGPL. This file was rewritten
from scratch looking just the docstrings of the original file.
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: freehep-xml/src/main/java/org/freehep/xml/util/XMLCharacterProperties.java
===================================================================
--- /dev/null
+++ freehep-xml/src/main/java/org/freehep/xml/util/XMLCharacterProperties.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2010 by Giovanni Mascellani <gio@debian.org>
+ * 
+ * This class is a substitute for the original XMLCharacterProperties
+ * in FreeHEP-XML, which is picked out from Xerces, but it licensed
+ * under Apache 1.1 license (GPL-incompatible). IT IS NOT A COMPLETE
+ * REPLACEMENT: it just implements the three methods needed by JAS Plotter.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+package org.freehep.xml.util;
+
+public class XMLCharacterProperties {
+
+	public static boolean isLetter(char c) {
+		return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'));
+	}
+
+	public static boolean isDigit(char c) {
+		return (c >= '0') && (c <= '9');
+	}
+
+	/*
+	 * [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+
+	 */
+	public static boolean validVersionNum(String name) {
+		int len = name.length();
+		if (len == 0) return false;
+		for (int i = 0; i < len; i++) {
+			char c = name.charAt(i);
+			if (!(isLetter(c) || isDigit(c) || c == '_' || c == '.' || c == ':' || c == '-')) return false;
+		}
+		return true;
+	}
+
+    /*
+     * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
+     */
+	public static boolean validEncName(String name) {
+		int len = name.length();
+		if (len == 0) return false;
+		if (!isLetter(name.charAt(0))) return false;
+		for (int i = 1; i < len; i++) {
+			char c = name.charAt(i);
+			if (!(isLetter(c) || isDigit(c) || c == '.' || c == '_' || c == '-')) return false;
+		}
+		return true;
+	}
+
+    /*
+     * [5] Name ::= (Letter | '_' | ':') (NameChar)*
+     */
+	public static boolean validName(String name) {
+		int len = name.length();
+		if (len == 0) return false;
+		char c = name.charAt(0);
+		if (!(isLetter(c) || c == '_' || c == ':')) return false;
+		for (int i = 1; i < len; i++) {
+			c = name.charAt(i);
+			if (!(isLetter(c) || isDigit(c) || c == '_' || c == '.' || c == ':' || c == '-')) return false;
+		}
+		return true;
+	}
+
+}
+
